#![warn(unsafe_code)]
pub mod argument;
pub mod command;
pub mod complete;
pub mod completion;
pub mod context;
pub mod decorators;
pub mod error;
pub mod formatting;
pub mod group;
pub mod option;
pub mod parameter;
pub mod parser;
mod source;
pub mod termui;
pub mod testing;
pub mod types;
pub mod utils;
pub use argument::{AnyTypeConverter, Argument, ArgumentBuilder, ShellCompleteCallback};
pub use command::{Command, CommandBuilder, CommandCallback};
pub use context::{get_current_context, pop_context, push_context, Context, ContextBuilder};
pub use decorators::{make_pass_decorator, PassDecorator};
pub use error::{ClickError, ErrorContext, ParamType, Result};
pub use group::{
CommandCollection, CommandCollectionBuilder, CommandLike, Group, GroupBuilder, ResultCallback,
};
pub use option::{parse_option_name, split_option_names, ClickOption, OptionBuilder};
pub use parameter::{DeprecationInfo, Nargs, Parameter, ParameterConfig};
pub use parser::{split_opt, OptionAction, OptionParser, ParseResult, ParsedValue};
pub use source::ParameterSource;
pub fn try_run<I>(cmd: &dyn CommandLike, args: I) -> Result<()>
where
I: IntoIterator<Item = String>,
{
cmd.main(args.into_iter().collect())
}
pub fn run(cmd: &dyn CommandLike) {
if let Err(e) = try_run(cmd, std::env::args().skip(1)) {
eprintln!("{}", e.format_full());
std::process::exit(e.exit_code());
}
}
pub fn run_with_completion(cmd: &dyn CommandLike, prog_name: &str, complete_var: &str) {
let completion_opt = completion::make_completion_option(complete_var);
if completion_opt.handle_completion(cmd, prog_name) {
return;
}
run(cmd);
}
pub use formatting::{
detect_terminal_width, get_terminal_width, make_rule, split_into_lines, truncate_text,
wrap_text, HelpFormatter,
};
#[cfg(feature = "derive")]
pub use click_derive::{command, group, Command, Group};
pub use types::{
BoolType,
Choice,
CompletionItem,
DateTimeType,
FileMode,
FileType,
FloatRange,
FloatType,
IntRange,
IntType,
LazyFile,
PathType,
StringType,
TupleType,
TupleValue,
TypeConverter,
UnprocessedType,
UuidType,
BOOL,
FLOAT,
INT,
STRING,
UNPROCESSED,
UUID,
};
pub use termui::{
clear, confirm, echo, echo_via_pager, edit_text, get_terminal_size, getchar, isatty, launch,
pause, progressbar, prompt, secho, stderr_isatty, stdin_isatty, stdout_isatty,
strip_ansi_codes, style, Color, ProgressBar,
};
pub use completion::{shell_complete, BashComplete, FishComplete, ShellComplete, ZshComplete};
pub use testing::{CliRunner, InvokeResult, IsolatedFilesystem};
pub use utils::{
expand_path, format_filename, get_app_dir, get_binary_stdout, get_os_args, get_text_stderr,
get_text_stdout, safecall, should_strip_ansi,
};