You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Riyyi
eb4822b44b
|
3 years ago | |
---|---|---|
src | 3 years ago | |
test | 3 years ago | |
.clang-format | 3 years ago | |
.gitignore | 3 years ago | |
CMakeLists.txt | 3 years ago | |
LICENSE | 3 years ago | |
README.org | 3 years ago | |
compile_commands.json | 3 years ago |
README.org
Stowage
Needed information for generation:
- short option
- long option
- short description (for usage ouput)
- long description (for manpage output)
Machine specific configuration
- Selection based on file name
- Config section selection based on pattern with machine name
- Possibly variable insertion and comment removal
Option Parsing
Parsed from left to right.
Types
- Short option
- Long option
- Argument to option
- Non-option parameter (default argument)
Short Option
'-' followed by short option character. If option has required argument, directly after OR separated by white-space. Optional argument must be directly after the option character.
Possible to write several short options after one '-', if all (except last) do not have required or optional arguments.
Long Option
'–' followed by long option name.
If option has a required argument, directly after, separated by '' OR white-space.
Optional argument must be directly after the option, separated by '
'.
Non-option Parameter
Each parameter not starting with '-' and not a required argument of a previous option, is a non-option parameter.
Each parameter after a '–' parameter is always interpreted as a non-option parameter.
Examples
./stowage -Fals
./stowage -F -a -l -s
./stowage --file --add --pull --push
./stowage -r filename
./stowage -rfilename
./stowage --remove=filename
./stowage --remove filename
./stowage --remove filename other stuff
./stowage --remove filename -- other stuff
Multiple of the same options
./stowage -e pattern1 -epattern2 --regexp=pattern3 --regexp pattern4
TODO
[24/38]
- macros: add more EXPECT_
- macros: print to stderr, add colors
- suite: improve printing style
- convert more tests from main()
- suite: add time tracking
- suite: print time info
- suite: add mechanism for EXPECT_ macros to mark current test as failed
- suite: print suite failed tests
- argparser: after first non option, go into no-option mode. this should be a setting to enable (default off)
- argparser: support '–' to go into non-option mode
- argparser: add multi-option support, vectors!
- argparser: support non-option arguments parsing + storing
- argparser: non-option arguments, what error messages, when?
- argparser: update tests to check non-option arguments
- argparser: add addOption overloads
- argparser: generate usage string
- argparser: generate man page string
- argparser: parse() function to return bool false if any error has occurred
- argparser: setting for failure behavior (usage/exit/usage+exit)
- argparser: add proper tests for non-existent options
- argparser: m_exitOnFirstError is implemented wrong in longOption, should also break in the main loop! I think its fine in shortOption as it can parse multiple arguments
- argparser: support optional arguments, if acceptvalue fails and arg is optional, increment index and try again
- argparser: receives empty parameters (at least arguments), decide what to do with them. $ uname bla => uname: extra operand ‘bla’
- argparser: dont use std::regex, just loop through characters and bail if unexpected
- argparser: support long option abbreviations, if they are not ambiguous
- argparser: support for single - long options
- argparser: check and set $value to $next before the if spaghetti to simplify, at least in longOption
- system: add piping functionality, print result of previous command to stdin before execvp() ?
- system: output/error/status getter, automatically call exec if workload
- system: output/error getter, cut off last character if its "\n", as std::string already handles trailing \n
- system: test with file descriptors captured in std::system
- system: write test cases
- system: fix bug: splitting on space needs to be escapable, ex: '\ ' or ' ' or " ", needs a lexer
- system: test if exec() can return a reference?
- dotfile: add loop index to forEachDotfile
- dotfile: convert excludePaths and system directories matching to regex
- dotfile: add excludePaths (ignore file) config file functionality https://systemcrafters.net/managing-your-dotfiles/using-gnu-stow/ https://www.gnu.org/software/stow/manual/stow.html#Types-And-Syntax-Of-Ignore-Lists
- dotfile: add system directories config file functionality