bashkit 0.8.0

Awesomely fast virtual sandbox with bash and file system
Documentation
// GENERATED by bashkit-coreutils-port. DO NOT EDIT.
//
// Source: uutils/coreutils@39364b6 src/uu/tee/
// Regenerate: cargo run -p bashkit-coreutils-port -- <UUTILS_DIR> tee <REV>
//
// Original uutils licensed MIT; see THIRD_PARTY_LICENSES.

#![allow(unused_imports, dead_code)]
use clap::builder::{
    NonEmptyStringValueParser, PossibleValue, PossibleValuesParser, TypedValueParser, ValueParser,
    ValueParserFactory,
};
use clap::{Arg, ArgAction, Command};
use std::ffi::{OsStr, OsString};
use std::ops::RangeInclusive;
use std::path::PathBuf;
use std::str::FromStr;
pub mod options {
    pub const APPEND: &str = "append";
    pub const IGNORE_INTERRUPTS: &str = "ignore-interrupts";
    pub const FILE: &str = "file";
    pub const IGNORE_PIPE_ERRORS: &str = "ignore-pipe-errors";
    pub const OUTPUT_ERROR: &str = "output-error";
}
#[allow(unused_imports)]
use options::*;
/// Vendored stand-in for `uucore::format_usage`.
///
/// Upstream wraps the usage line with stylized "Usage:" prefix logic
/// driven by uucore's locale stack. For our purposes the raw string
/// is enough; clap's `override_usage` accepts the literal as-is.
fn format_usage(s: &str) -> String {
    s.to_string()
}
/// Sidecar harvest of every `Arg::env(...)` annotation the codegen
/// stripped from the runtime Arg chain (TM-INF-024). Consumed by
/// `crate::builtins::clap_env::apply_env_defaults` so bashkit's
/// virtual `ctx.env` — never `std::env` — drives clap's env-default
/// path. Order matches the chain order in the original `uu_app()`.
pub static TEE_ENV_DEFAULTS: &[crate::builtins::clap_env::EnvDefault] = &[];
pub fn tee_command() -> Command {
    Command::new("tee")
        .version(env!("CARGO_PKG_VERSION"))
        .about(
            ::std::string::String::from(
                "Copy standard input to each FILE, and also to standard output.",
            ),
        )
        .override_usage(
            format_usage(&::std::string::String::from("tee [OPTION]... [FILE]...")),
        )
        .after_help(
            ::std::string::String::from("If a FILE is -, it refers to a file named - ."),
        )
        .infer_long_args(true)
        .disable_help_flag(true)
        .arg(
            Arg::new("--help")
                .short('h')
                .long("help")
                .help(::std::string::String::from("Print help"))
                .action(ArgAction::HelpLong),
        )
        .arg(
            Arg::new(options::APPEND)
                .long(options::APPEND)
                .short('a')
                .help(
                    ::std::string::String::from(
                        "append to the given FILEs, do not overwrite",
                    ),
                )
                .action(ArgAction::SetTrue)
                .overrides_with(options::APPEND),
        )
        .arg(
            Arg::new(options::IGNORE_INTERRUPTS)
                .long(options::IGNORE_INTERRUPTS)
                .short('i')
                .help(
                    ::std::string::String::from(
                        "ignore interrupt signals (ignored on non-Unix platforms)",
                    ),
                )
                .action(ArgAction::SetTrue),
        )
        .arg(
            Arg::new(options::FILE)
                .action(ArgAction::Append)
                .value_hint(clap::ValueHint::FilePath)
                .value_parser(clap::value_parser!(OsString)),
        )
        .arg(
            Arg::new(options::IGNORE_PIPE_ERRORS)
                .short('p')
                .help(
                    ::std::string::String::from(
                        "set write error behavior (ignored on non-Unix platforms)",
                    ),
                )
                .action(ArgAction::SetTrue),
        )
        .arg(
            Arg::new(options::OUTPUT_ERROR)
                .long(options::OUTPUT_ERROR)
                .require_equals(true)
                .num_args(0..=1)
                .default_missing_value("warn-nopipe")
                .value_parser(
                    ::clap::builder::PossibleValuesParser::new([
                        PossibleValue::new("warn")
                            .help(
                                ::std::string::String::from(
                                    "produce warnings for errors writing to any output",
                                ),
                            ),
                        PossibleValue::new("warn-nopipe")
                            .help(
                                ::std::string::String::from(
                                    "produce warnings for errors that are not pipe errors (ignored on non-unix platforms)",
                                ),
                            ),
                        PossibleValue::new("exit")
                            .help(
                                ::std::string::String::from(
                                    "exit on write errors to any output",
                                ),
                            ),
                        PossibleValue::new("exit-nopipe")
                            .help(
                                ::std::string::String::from(
                                    "exit on write errors to any output that are not pipe errors (equivalent to exit on non-unix platforms)",
                                ),
                            ),
                    ]),
                )
                .help(::std::string::String::from("set write error behavior")),
        )
}