Consistency in the example declaration

This commit is contained in:
Sylvestre Ledru 2023-03-04 18:36:12 +01:00
parent 6c44ed2efd
commit a02cb75129
4 changed files with 52 additions and 52 deletions

View file

@ -31,7 +31,7 @@ Code coverage report can be generated using [grcov](https://github.com/mozilla/g
To generate [gcov-based](https://github.com/mozilla/grcov#example-how-to-generate-gcda-files-for-a-rust-project) coverage report
```bash
```shell
export CARGO_INCREMENTAL=0
export RUSTFLAGS="-Zprofile -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort"
export RUSTDOCFLAGS="-Cpanic=abort"

View file

@ -21,7 +21,7 @@ or different behavior might be experienced.
To install it:
```bash
```shell
cargo install coreutils
~/.cargo/bin/coreutils
```
@ -66,7 +66,7 @@ or GNU Make.
For either method, we first need to fetch the repository:
```bash
```shell
git clone https://github.com/uutils/coreutils
cd coreutils
```
@ -76,7 +76,7 @@ cd coreutils
Building uutils using Cargo is easy because the process is the same as for
every other Rust program:
```bash
```shell
cargo build --release
```
@ -87,7 +87,7 @@ Additional platform-specific uutils are often available. Building these
expanded sets of uutils for a platform (on that platform) is as simple as
specifying it as a feature:
```bash
```shell
cargo build --release --features macos
# or ...
cargo build --release --features windows
@ -99,7 +99,7 @@ If you don't want to build every utility available on your platform into the
final binary, you can also specify which ones you want to build manually.
For example:
```bash
```shell
cargo build --features "base32 cat echo rm" --no-default-features
```
@ -109,7 +109,7 @@ is contained in its own package within the main repository, named
"uu_UTILNAME". To build individual utilities, use cargo to build just the
specific packages (using the `--package` [aka `-p`] option). For example:
```bash
```shell
cargo build -p uu_base32 -p uu_cat -p uu_echo -p uu_rm
```
@ -119,19 +119,19 @@ Building using `make` is a simple process as well.
To simply build all available utilities:
```bash
```shell
make
```
To build all but a few of the available utilities:
```bash
```shell
make SKIP_UTILS='UTILITY_1 UTILITY_2'
```
To build only a few of the available utilities:
```bash
```shell
make UTILS='UTILITY_1 UTILITY_2'
```
@ -141,7 +141,7 @@ make UTILS='UTILITY_1 UTILITY_2'
Likewise, installing can simply be done using:
```bash
```shell
cargo install --path .
```
@ -154,43 +154,43 @@ use `GNU Make` or see `Manually install shell completions`.
To install all available utilities:
```bash
```shell
make install
```
To install using `sudo` switch `-E` must be used:
```bash
```shell
sudo -E make install
```
To install all but a few of the available utilities:
```bash
```shell
make SKIP_UTILS='UTILITY_1 UTILITY_2' install
```
To install only a few of the available utilities:
```bash
```shell
make UTILS='UTILITY_1 UTILITY_2' install
```
To install every program with a prefix (e.g. uu-echo uu-cat):
```bash
```shell
make PROG_PREFIX=PREFIX_GOES_HERE install
```
To install the multicall binary:
```bash
```shell
make MULTICALL=y install
```
Set install parent directory (default value is /usr/local):
```bash
```shell
# DESTDIR is also supported
make PREFIX=/my/path install
```
@ -206,14 +206,14 @@ and `zsh` shells. It prints the result to stdout.
The syntax is:
```bash
```shell
cargo run completion <utility> <shell>
```
So, to install completions for `ls` on `bash` to `/usr/local/share/bash-completion/completions/ls`,
run:
```bash
```shell
cargo run completion ls bash > /usr/local/share/bash-completion/completions/ls
```
@ -227,7 +227,7 @@ Make to uninstall.
To uninstall uutils:
```bash
```shell
cargo uninstall uutils
```
@ -235,25 +235,25 @@ cargo uninstall uutils
To uninstall all utilities:
```bash
```shell
make uninstall
```
To uninstall every program with a set prefix:
```bash
```shell
make PROG_PREFIX=PREFIX_GOES_HERE uninstall
```
To uninstall the multicall binary:
```bash
```shell
make MULTICALL=y uninstall
```
To uninstall from a custom parent directory:
```bash
```shell
# DESTDIR is also supported
make PREFIX=/my/path uninstall
```
@ -269,32 +269,32 @@ Testing can be done using either Cargo or `make`.
Just like with building, we follow the standard procedure for testing using
Cargo:
```bash
```shell
cargo test
```
By default, `cargo test` only runs the common programs. To run also platform
specific tests, run:
```bash
```shell
cargo test --features unix
```
If you would prefer to test a select few utilities:
```bash
```shell
cargo test --features "chmod mv tail" --no-default-features
```
If you also want to test the core utilities:
```bash
```shell
cargo test -p uucore -p coreutils
```
To debug:
```bash
```shell
gdb --args target/debug/coreutils ls
(gdb) b ls.rs:79
(gdb) run
@ -304,25 +304,25 @@ gdb --args target/debug/coreutils ls
To simply test all available utilities:
```bash
```shell
make test
```
To test all but a few of the available utilities:
```bash
```shell
make SKIP_UTILS='UTILITY_1 UTILITY_2' test
```
To test only a few of the available utilities:
```bash
```shell
make UTILS='UTILITY_1 UTILITY_2' test
```
To include tests for unimplemented behavior:
```bash
```shell
make UTILS='UTILITY_1 UTILITY_2' SPEC=y test
```
@ -333,19 +333,19 @@ requires `make`.
To run busybox tests for all utilities for which busybox has tests
```bash
```shell
make busytest
```
To run busybox tests for a few of the available utilities
```bash
```shell
make UTILS='UTILITY_1 UTILITY_2' busytest
```
To pass an argument like "-v" to the busybox test runtime
```bash
```shell
make UTILS='UTILITY_1 UTILITY_2' RUNTEST_ARGS='-v' busytest
```
@ -359,7 +359,7 @@ breakdown of the GNU test results of the main branch can be found
To run locally:
```bash
```shell
bash util/build-gnu.sh
bash util/run-gnu-test.sh
# To run a single test:

View file

@ -14,7 +14,7 @@ You can also [build uutils from source](/build.md).
[![crates.io package](https://repology.org/badge/version-for-repo/crates_io/uutils-coreutils.svg)](https://repology.org/project/uutils-coreutils/versions)
```bash
```shell
# Linux
cargo install coreutils --features unix
# MacOs
@ -29,7 +29,7 @@ cargo install coreutils --features windows
[![Alpine Linux Edge package](https://repology.org/badge/version-for-repo/alpine_edge/uutils-coreutils.svg)](https://pkgs.alpinelinux.org/packages?name=uutils-coreutils)
```bash
```shell
apk update uutils-coreutils
```
@ -39,7 +39,7 @@ apk update uutils-coreutils
[![Arch package](https://repology.org/badge/version-for-repo/arch/uutils-coreutils.svg)](https://archlinux.org/packages/community/x86_64/uutils-coreutils/)
```bash
```shell
pacman -S uutils-coreutils
```
@ -47,7 +47,7 @@ pacman -S uutils-coreutils
[![Debian package](https://repology.org/badge/version-for-repo/debian_unstable/uutils-coreutils.svg)](https://packages.debian.org/sid/source/rust-coreutils)
```bash
```shell
apt install rust-coreutils
# To use it:
export PATH=/usr/lib/cargo/bin/coreutils:$PATH
@ -59,7 +59,7 @@ export PATH=/usr/lib/cargo/bin/coreutils:$PATH
[![Gentoo package](https://repology.org/badge/version-for-repo/gentoo/uutils-coreutils.svg)](https://packages.gentoo.org/packages/sys-apps/uutils-coreutils)
```bash
```shell
emerge -pv sys-apps/uutils-coreutils
```
@ -69,7 +69,7 @@ emerge -pv sys-apps/uutils-coreutils
[![Manjaro Testing package](https://repology.org/badge/version-for-repo/manjaro_testing/uutils-coreutils.svg)](https://repology.org/project/uutils-coreutils/versions)
[![Manjaro Unstable package](https://repology.org/badge/version-for-repo/manjaro_unstable/uutils-coreutils.svg)](https://repology.org/project/uutils-coreutils/versions)
```bash
```shell
pacman -S uutils-coreutils
# or
pamac install uutils-coreutils
@ -79,7 +79,7 @@ pamac install uutils-coreutils
[![nixpkgs unstable package](https://repology.org/badge/version-for-repo/nix_unstable/uutils-coreutils.svg)](https://repology.org/project/uutils-coreutils/versions)
```bash
```shell
nix-env -iA nixos.uutils-coreutils
```
@ -87,7 +87,7 @@ nix-env -iA nixos.uutils-coreutils
[![openmandriva cooker package](https://repology.org/badge/version-for-repo/openmandriva_cooker/uutils-coreutils.svg)](https://repology.org/project/uutils-coreutils/versions)
```bash
```shell
dnf install uutils-coreutils
```
@ -95,7 +95,7 @@ dnf install uutils-coreutils
[![Ubuntu package](https://repology.org/badge/version-for-repo/ubuntu_23_04/uutils-coreutils.svg)](https://packages.ubuntu.com/source/lunar/rust-coreutils)
```bash
```shell
apt install rust-coreutils
# To use it:
export PATH=/usr/lib/cargo/bin/coreutils:$PATH
@ -109,7 +109,7 @@ export PATH=/usr/lib/cargo/bin/coreutils:$PATH
[![Homebrew package](https://repology.org/badge/version-for-repo/homebrew/uutils-coreutils.svg)](https://formulae.brew.sh/formula/uutils-coreutils)
```bash
```shell
brew install uutils-coreutils
```
@ -135,7 +135,7 @@ pkg install uutils
[![Scoop package](https://repology.org/badge/version-for-repo/scoop/uutils-coreutils.svg)](https://scoop.sh/#/apps?q=uutils-coreutils&s=0&d=1&o=true)
```bash
```shell
scoop install uutils-coreutils
```

View file

@ -30,7 +30,7 @@ This can also be used to compare with version of ls built before your changes to
Here is a `bash` script for doing this comparison:
```bash
```shell
#!/bin/bash
cargo build --no-default-features --features ls --release
args="$@"
@ -48,13 +48,13 @@ hyperfine "ls $args" "target/release/coreutils ls $args"
With Cargo Flamegraph you can easily make a flamegraph of `ls`:
```bash
```shell
cargo flamegraph --cmd coreutils -- ls [additional parameters]
```
However, if the `-R` option is given, the output becomes pretty much useless due to recursion. We can fix this by merging all the direct recursive calls with `uniq`, below is a `bash` script that does this.
```bash
```shell
#!/bin/bash
cargo build --release --no-default-features --features ls
perf record target/release/coreutils ls "$@"