shell-functools
shell-functools copied to clipboard
Functional programming tools for the shell
I am not using this project actively myself. I still like the general idea, but I also think this project has a few limitations (e.g. #19) which I am not...
The `run` function currently only works a single word, so trying to use command line argument with a command doesn't work (e.g., 'chmod 755'). The version adds that capability: ```...
The current `join` function fails if a line of input only has one column (i.e., not an array). The update below allow it to function in that case: ``` @register("join")...
`sort_by` currently only supports ascending sorts. The following allows descending sorts: _For README.md_: ``` ### Usage of `sort_by` The `sort_by` command also takes a [function argument](#available-function-arguments). It calls the function...
The current `format` function only support single-valued inputs. The below permits it to take arrays as inputs: For _ft/ft/functions.py_: ``` @register("format") @typed(None, T_STRING) def format(format_str, inp): try: if type(inp) ==...
``` > echo -e '1\t2' | filter -c1 odd Traceback (most recent call last): File "/home/jdhedden/bin/filter", line 6, in Filter().run() File "/mnt/data/Computer/Linux/shell-functools/ft/ft/command.py", line 101, in run self.handle_input(value) File "/mnt/data/Computer/Linux/shell-functools/ft/ft/commands/filter.py", line...
How about custom functions support (or plugins) Like: ``` seq 5 | filter is_odd ``` will return: ``` 1 3 5 ``` where `is_odd` is custom function (e.g. in `~/.config/shell-functools/plugins/main.py`...
As we always read strings via stdin, we have to guess the type of each input line (via `add_dynamic_type`). This can lead to errors: ``` bash > touch a b...
- [ ] More string utilities (e.g. regex functions) - [x] Formatting functions (`echo 3.1415 | map format "{:.2f}"`)
It would be great if we could apply `flip` to a function before we hand it over to a command. For example (suppose that `%` is a `flip`-operator): ``` >...