Crates.io | axe-cli |
lib.rs | axe-cli |
version | 0.3.0 |
source | src |
created_at | 2024-09-21 18:16:12.775106 |
updated_at | 2024-10-02 20:16:22.655543 |
description | axe - Argument execute is xargs alternative that focus on arguments processing and ordering. |
homepage | |
repository | https://github.com/jacek-kurlit/axe |
max_upload_size | |
id | 1382392 |
size | 64,679 |
Argument execute is xargs alternative that focus on arguments processing and ordering.
This tool is still under heavy development
echo "foo bar baz" | axe echo {2} {1} {0}
output: baz bar foo
echo "a b c\nd e f" | axe echo {}
output:
a b c
d e f
Explanation: Each new line is treated as a data entry. Echo command will be run for each line. This is equal to calling
echo a b c
echo d e f
echo "lord_of_the_rings.txt" | axe echo "this is file name '{0.0}' and this is file extension '{0.1}'"
output: this is file name 'lord_of_the_rings' and this is file extension 'txt'
echo "a_b c_d e_f" | axe echo {_0}
output: a c e
Archives of precompiled binaries for axe are available for Linux and macOS.
With dra
dra download -i -a -o ~/.local/bin jacek-kurlit/axe
With eget
eget jacek-kurlit/axe --to=~/.local/bin
If you're a Rust programmer, axe can be installed with cargo
.
cargo install axe-cli
Lets consider the following example stdin input:
a b c
d e f
h i j
If we pass it to axe echo {}
axe will call echo 3 times for each line.
On each line space will be treated as an arguments separator.
As result axe will resolve and call echo like this:
echo a b c
echo d e f
echo h i j
Each entry line will be split by arguments separator that can be chosen by the user (by default space). You may then refer to each argument by its index. For example:
echo "a b c" | axe echo {0}
There is only one entry with 3 arguments.
Echo will print first argument which is a
.
Each argument can be splitted into multiple arguments. For example:
echo "a.b c.d e.d_f.g" | axe echo {1.1} {0.0} {2_0}
Axe will read this as follows:
d
)a
)e.d
)Arguments can be resolved into arrays. For example:
echo "f1.txt f2.txt f3.txt" | axe echo {.0}
Axe will read this as follows:
{.0} split all arguments by '.' and for each item choose first part (f1, f2, f3
)
You may split each argument into multiple items
echo "f1.txt f2.txt f3.txt" | axe echo {0.} {1}
Axe will read this as follows:
{0.} split first argument by '.' and choose all parts (f1, txt
)
{1} take second argument(f2.txt
)
Output f1 txt f2.txt
Every time I was using xargs command I was frustrated that I cannot tell where I want to place arguments. This missing feature made me decide to create my own tool.
git clone https://github.com/jacek-kurlit/axe
cd axe
cargo build --release
./target/release/axe --version