command_kit.rb
command_kit.rb copied to clipboard
A Ruby toolkit for building complete and robust CLI commands.
Add a `CommandKit::Options::Type` base class to make it easier to define custom `OptionParser.accept` types. ### Example ```ruby class CustomType < CommandKit::Options::Type usage 'CUSTOM' pattern /.../ def self.parse(value) # ... end...
Add a module for capturing output written to `$stdout` or `$stderr` using `StringIO` and return the `string` contents.
Add a CWD module with accepts a `cwd: ` keyword for setting the current working directory in `#main`. This may be useful in testing.
It should be possible to initialize a command with a root file-system path other than `/` for testing purposes.
It should be possible to initialize a Command with a custom `cwd:` value, which the command will change to using `Dir.chdir(cwd) { ... }`, for testing purposes.
Add a module for defining a default command to run instead of `help`.
`CommandKit::Commands::AutoRequire` should search `$LOAD_PATH` for available commands that could be required. This would allow the module to list available commands that are in `$LOAD_PATH` (ex: from other 3rd-party gems that...
Add a `CommandKit::Printing::Tables` module: * Must support printing Arrays of Arrays (rows of columns). * Must calculate maximum length of each cell and left-pad cells. * May allow adding separator...
I've spent some more time unironically reading the README and I have a few ideas: 1. Format ruby code with ruby codefence 1. Wordsmith the Features section to highlight the...
Port command_kit to [Crystal](https://crystal-lang.org/).