1pub mod script;
2pub mod shell;
3pub mod value;
4
5pub(crate) use aopt_core as acore;
6
7pub(crate) const SHELL_BASH: &str = "bash";
8pub(crate) const SHELL_FISH: &str = "fish";
9pub(crate) const SHELL_ZSH: &str = "zsh";
10pub(crate) const SHELL_PSH: &str = "powershell";
11pub(crate) const SHELL_PSH7: &str = "powershell7";
12
13pub use acore::error;
14pub use acore::failure;
15
16use std::borrow::Cow;
17use std::ffi::OsStr;
18use std::ffi::OsString;
19
20pub(crate) use acore::Error;
21
22pub struct Context<'a> {
23 pub args: &'a [OsString],
24
25 pub curr: Cow<'a, OsStr>,
27
28 pub prev: Cow<'a, OsStr>,
30
31 pub cword: usize,
33}
34
35impl<'a> Context<'a> {
36 pub fn new(args: &'a [OsString], curr: &'a OsString, prev: &'a OsString, cword: usize) -> Self {
37 Self {
38 args,
39 curr: std::borrow::Cow::Borrowed(curr),
40 cword,
41 prev: std::borrow::Cow::Borrowed(prev),
42 }
43 }
44}