https://github.com/cetanu/zargs
A rewrite of xargs in Rust, for fun and science
https://github.com/cetanu/zargs
Last synced: over 1 year ago
JSON representation
A rewrite of xargs in Rust, for fun and science
- Host: GitHub
- URL: https://github.com/cetanu/zargs
- Owner: cetanu
- Created: 2020-11-13T09:11:35.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-11-14T12:07:21.000Z (over 5 years ago)
- Last Synced: 2025-01-22T01:13:32.924Z (over 1 year ago)
- Language: Rust
- Size: 14.6 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# zargs
A rewrite of xargs in Rust, for fun and science
Todo list
---------
Parameters implemented from `xargs`:
- [x] "Args file" ie. "Read items from file instead of standard input."
- [x] "Delimiter" ie. "Input items are terminated by the specified character."
- [x] "Replace" ie. "Replace occurrences of a string in the initial-arguments with names read from standard input."
- [x] ~"max-procs" ie. "Run up to max-procs processes at a time; the default is 1."~ uses Rayon for parallelization
Not sure if I can about other parameters! Maybe I can be convinced otherwise.
Installation
------------
```shell
cargo install zargs
```
Example Usage
-------------
#### Replacing strings, in the target command, with piped arguments
```shell
echo Vasilios | zargs -r name echo "Hello, name!"
Hello, Vasilios!
```
#### Should work on Windows!
```shell
echo "write-output 'hello world :)'" | zargs powershell
hello world :)
```
Help prompt
-----------
```
$ zargs --help
zargs 0.1.1
Vasilios Syrakis
USAGE:
zargs [OPTIONS] [command]...
ARGS:
... The command to execute against the args
FLAGS:
-h, --help Prints help information
-V, --version Prints version information
OPTIONS:
-a, --arg-file Read args from a file
-d, --delimiter Split the args by a particular delimiter
-p, --parallel The number of threads to run in parallel [default: 1]
-r, --replace Replace occurences of this with args read from stdin
```