Commit Graph

53 Commits

Author SHA1 Message Date
Etan Kissling d784b823be
add `{.raises.}` annotation to `writeValue` (#88)
Tag `writeValue` override with `{.raises: [IOError].}`.
2023-08-19 18:31:42 +02:00
Etan Kissling c67257660b
return empty completion lines on unsupported `COMP_POINT` (#76)
When `COMP_POINT` is invalid or out of range, return an empty list of
completions instead of raising `ValueError`. This matches behaviour for
`comp_point < 0 or comp_point > len(comp_line)` cases.
2023-07-07 14:03:23 +03:00
Etan Kissling d0d6fb45b2
catch exceptions in `splitCompletionLine` (#77)
We currently return `@[]` in `splitCompletionLine` when there is
unexpected or unsupported input via environment variables, but let
exceptions during parsing propagate to the caller. Catching those
exceptions allows the caller to use same behaviour regardless of
the nature of unexpected input (either through env, or parsing).
Currently, callers don't seem to be aware of the exceptions, so
going with the behaviour used for environment errors of returning `@[]`.
2023-06-13 10:36:33 +02:00
Etan Kissling 8522393cec
annotate `parseCmdArg` with `{.raises.}` (#84)
For the `parseCmdArg` that may fail with `ValueError`, add annotations.
2023-06-08 13:25:05 +00:00
tersec 10e53c3a67
use --mm: instead of --gc: and remove stddefects import (#85)
* use --mm: instead of --gc: and remove stddefects import

* remove incorrect trailing ":" from line
2023-06-08 13:12:32 +00:00
Adam Uhlíř 2028b41602
feat: integrate env. variable support natively (#70) 2023-04-19 12:54:48 +03:00
jangko 38dfeaaabd
reduce compiler warnings 2023-02-15 15:26:53 +07:00
Jacek Sieka 269c17401d
update CI, normalise nimble (#61) 2022-11-23 17:30:29 +01:00
jangko a26bfab7e5
fix config file test due to toml-serialization changes 2022-09-23 09:45:15 +07:00
Zahary Karadjov 5d0d864510
FieldTag no longer requires specifying the FieldType 2022-06-18 13:30:42 +03:00
tersec fc03a0c4e1
rm TaintedString for string; some proc -> func (#53)
* rm TaintedString for string; some proc -> func

* procs which interact with macros in certain ways can't be funcs in Nim 1.2
2022-06-03 18:24:59 +00:00
jangko d06f6187dc
fix #49: field type with qualified ident 2022-05-10 12:18:06 +07:00
jangko 8f8f715f76
fix nnkAccQuoted entry processing in config-file
fixes #47
2022-04-16 18:28:38 +07:00
Ștefan Talpalaru 9826fddd1c
fix corner case with custom pragma (#42)
The AST changes when you call the same custom pragma more than once.
2022-03-11 14:28:28 +01:00
Zahary Karadjov 375b6276ca
Don't use fully qualified enum values as the names of TOML file sections - use the short enum name instead 2022-03-09 17:12:11 +02:00
Zahary Karadjov 0a88d30e00
Clean up the obsolete config loading code; Fix the tests 2022-03-05 15:07:57 +02:00
Zahary Karadjov 0fc26c5b25
Bugfixes for the config file support
- The config files processing was not taking into account the `name`
  pragma of the configuration object fields.

- The required fields were not searched within config files before
  reporting an error that they are missing.

- Fields with the same names were not supported in different case branches

- The loaded config file path can now depend on the configuration
  supplied through the command-line.
2022-03-04 23:24:58 +02:00
Kim De Mey 05a438414a
Enable --styleCheck:usages (#41) 2022-02-24 21:43:04 +01:00
jangko 6a56d01381 feature: add `ignore` property in addition to `hidden`
you can still set the value of a hidden option,
it just dont show up in the help text.

but using `ignore`, the is no chance you can set the value from cli.
2021-12-01 13:59:38 +02:00
jangko 0f4961822d feature: multiple lines long description
line break char: '\n', '\r'
example:
 -x, --name   regular description [=defVal].
              longdesc line one.
              longdesc line two.
              longdesc line three.

why additional pragma?
- to keep the default value not too far away from the 'name'.
2021-11-30 20:09:45 +02:00
jangko aa0ff5b0dc feature: separator text when displaying help
SEPARATOR:
-abbr, --name desc
-abbr, --name desc

---------
-abbr, --name desc
-abbr, --name desc
-abbr, --name desc
2021-09-08 15:56:51 +03:00
Zahary Karadjov bb6cbf6e0d
Display the default values of parameter in the help messages 2021-05-16 21:42:12 +03:00
Zahary Karadjov 66a17f6d23
Handle hidden parameters in config files 2021-05-16 19:08:51 +03:00
Zahary Karadjov f091a70a5b
Handle changes in the serialization library 2021-03-19 04:01:44 +02:00
jangko f3a048f9ea config file integration into confutils 2020-11-02 16:17:51 +02:00
jangko 085d52d3ad fixes winreg Option[T] decoder 2020-10-29 13:52:31 +02:00
jangko 1e1ba43af2 separate public types and private utils 2020-10-29 13:52:31 +02:00
jangko 4304251b09 winreg encoder-decoder implementation 2020-10-29 13:52:31 +02:00
jangko 0df747294e initial winreg implementation 2020-10-29 13:52:31 +02:00
jangko b961fbe7b4 fixes envvar Option[T] decoder 2020-10-29 13:52:16 +02:00
jangko f4087c1789 fixes string encoding for envvar serialization 2020-10-29 13:52:16 +02:00
jangko a263d76bc0 envvar encoder decoder implementation 2020-10-29 13:52:16 +02:00
Zahary Karadjov 5d8d1ea648
0 is not a valid TCP/UDP port 2020-10-09 16:29:48 +03:00
Zahary Karadjov 5c81aab54d
Add a helper module for fuzzing CLI parsers 2020-10-01 22:04:53 +03:00
Zahary Karadjov 39456fa3d5
Hidden configuration fields (initial faux version) 2020-07-02 18:27:50 +03:00
Zahary Karadjov aac25d1610
Fix #18; Fix parsing of sub-commands with descriptions 2020-06-16 18:22:41 +03:00
Zahary Karadjov 26667818be
IpAddress -> ValidIpAddress 2020-06-05 17:09:05 +03:00
Zahary Karadjov 6f109184e3
$ op for the specialized Confutils types 2020-06-02 17:38:07 +03:00
Zahary Karadjov 24c73359b0
Add a helper module for handing IP addresses and ports 2020-03-16 23:47:48 +02:00
Zahary Karadjov 51df90466d
Renamed longform/shortform to name/abbr; Wire-up the version command 2019-11-11 14:42:08 +00:00
Zahary Karadjov 4ba6c64761
Remove warnings with Nim 1.0 2019-11-08 17:57:44 +00:00
Zahary Karadjov 6f5f030539
Fix #6 2019-11-08 16:28:04 +00:00
Zahary Karadjov d9e815fe67
Handle gracefully NimScript invocations with additional Nim settings such as --verbosity:x 2019-10-29 13:56:53 +02:00
Zahary Karadjov aa5ccdd57f
Restore compilation with nimscript; More colorful help output 2019-10-23 03:30:40 +03:00
Zahary Karadjov 937c09e204
Support for arbitrary sub-command nesting 2019-09-30 02:40:16 +03:00
LemonBoy 4c6846733d Handling paths is hard 2019-07-05 16:17:58 +03:00
LemonBoy 68e7691275 Add quoteWord proc 2019-07-05 16:17:58 +03:00
LemonBoy cef93bbd95 Initial support for command-line completion
Using the Bash protocol (COMP_LINE & COMP_POINT).
2019-07-05 16:17:58 +03:00
Zahary Karadjov 30309748a0 Some steps towards enabling the use of confutils in nimscript
So far, a show-stopped Nim bug was discovered:
https://github.com/nim-lang/Nim/issues/11502
2019-06-14 19:33:59 +03:00
Zahary Karadjov bec75f7cec Input validation for dir/file params; Typed input files
Also adds support for referencing the config object within the
`defaultValue` expressions.
2019-03-18 04:01:07 +02:00