Revert "README for this fork" This reverts commit97db461e7f. Revert "Allow foo=bar global variable assignments" This reverts commit45a2017580. Revert "Interpret () in command position as subshell" This reverts commit0199583435. Revert "Allow special variables $?,$$,$@,$#" This reverts commit4a71ee1288. Revert "Allow $() in command position" This reverts commit4b99fe2288. Revert "Turn off full LTO" This reverts commitb1213f1385. Revert "Back out "bind: Remove "c-" and "a-" shortcut notation"" This reverts commitf43abc42f9. Revert "Un-hide documentation of non-fish shell builtins" This reverts commit485201ba2e.
fish-printf
The printf implementation used in fish-shell, based on musl printf.
Licensed under the MIT license.
Usage
Run cargo add fish-printf to add this crate to your Cargo.toml file.
Notes
fish-printf attempts to match the C standard for printf. It supports the following features:
- Locale-specific formatting (decimal point, thousands separator, etc.)
- Honors the current rounding mode.
- Supports the
%nmodifier for counting characters written.
fish-printf does not support positional arguments, such as printf("%2$d", 1, 2).
Prefixes like l or ll are recognized, but only used for validating the format string.
The size of integer values is taken from the argument type.
fish-printf can output to an std::fmt::Write object, or return a string.
For reasons related to fish-shell, fish-printf has a feature "widestring" which uses the widestring crate. This is off by default. If enabled, run cargo add widestring to add the widestring crate.
Examples
use fish_printf::sprintf;
// Create a `String` from a format string.
let s = sprintf!("%0.5g", 123456.0) // 1.2346e+05
// Append to an existing string.
let mut s = String::new();
sprintf!(=> &mut s, "%0.5g", 123456.0) // 1.2346e+05
See the crate documentation for additional examples.