Crates.io | slice-command |
lib.rs | slice-command |
version | 0.4.2 |
source | src |
created_at | 2023-04-20 13:58:30.89786 |
updated_at | 2024-11-13 05:17:56.810349 |
description | slice is a command-line tool that allows you to slice the contents of a file using syntax similar to Python's slice notation. |
homepage | |
repository | https://github.com/ChanTsune/slice.git |
max_upload_size | |
id | 844393 |
size | 85,163 |
Slice is a command-line tool written in Rust that allows you to slice the contents of a file using syntax similar to Python's slice notation.
brew install chantsune/tap/slice
nix-env --install -f https://github.com/chantsune/slice/tarball/main
cargo install slice-command
git clone https://github.com/ChanTsune/slice.git
cd slice
cargo install --path .
After building, add the binary to your PATH to use it globally.
To use slice
, run the following command:
slice [options] <slice> <file...>
<file>
is the name of the file you want to slice, and <slice>
is the slice syntax you want to apply to the file.
If <file>
is not specified, slice
will read from standard input.
The slice syntax is similar to Python's slice syntax, with the format start:end:step
.
Each value is optional and, if omitted, defaults to the beginning of the file, the end of the file, and a step of 1, respectively.
Here are some examples of how to use slice
:
slice 10:20 file.txt
This command slices the contents of file.txt
from line 10 to line 20.
slice :100:2 file.txt
This command slices the contents of file.txt
from the beginning of the file to line 100, skipping every second line.
slice 5:+10 file.txt
This command is the same as slice
5:15 file.txt`.
For more details, run:
slice --help
docker build -t slice .
docker run -v `pwd`:`pwd` -w `pwd` --rm -i slice
Dual-licensed under MIT or Apache-2.0.