Fix bootstrap for all three binaries

This commit is contained in:
Nathan Fisher 2023-02-13 10:30:46 -05:00
parent 83fcb52d80
commit 0450cdfee6
393 changed files with 16849 additions and 29 deletions

View File

@ -162,7 +162,7 @@ impl Cmd for Bootstrap {
fs::create_dir_all(&outpath)?;
println!(" mkdir: {}", outpath.display());
}
outpath.push(env!("CARGO_PKG_NAME"));
outpath.push(&shitbox::progname().unwrap());
fs::copy(&progpath, &outpath)?;
println!(
" install: {} -> {}",
@ -175,15 +175,15 @@ impl Cmd for Bootstrap {
links(prefix, usr, matches)?;
}
Some(("manpages", _matches)) => {
manpages(prefix)?;
manpages(prefix, usr)?;
}
Some(("completions", matches)) => {
completions(prefix, matches)?;
completions(prefix, matches, usr)?;
}
Some(("all", matches)) => {
links(prefix, usr, matches)?;
manpages(prefix)?;
completions(prefix, matches)?;
manpages(prefix, usr)?;
completions(prefix, matches, usr)?;
}
_ => {}
}
@ -201,7 +201,7 @@ pub trait BootstrapCmd {
fn completion(&self, outdir: &Path, gen: &str) -> Result<(), io::Error>;
fn linkpath(&self, prefix: &str, usr: bool) -> Option<PathBuf>;
fn link(&self, prefix: &str, usr: bool, soft: bool) -> Result<(), Box<dyn Error>>;
fn manpage(&self, prefix: &str) -> Result<(), io::Error>;
fn manpage(&self, prefix: &str, usr: bool) -> Result<(), io::Error>;
}
impl BootstrapCmd for dyn Cmd {
@ -237,31 +237,33 @@ impl BootstrapCmd for dyn Cmd {
fn link(&self, prefix: &str, usr: bool, soft: bool) -> Result<(), Box<dyn Error>> {
if let Some(linkpath) = self.linkpath(prefix, usr) {
let progname = shitbox::progname().unwrap();
if soft {
let binpath = match self.path().unwrap() {
shitbox::Path::Bin => "shitbox",
shitbox::Path::Sbin => "../bin/shitbox",
shitbox::Path::Bin => progname,
shitbox::Path::Sbin => format!("../bin/{progname}"),
shitbox::Path::UsrBin => {
if usr {
"../../bin/shitbox"
format!("../../bin/{progname}")
} else {
"shitbox"
progname
}
}
shitbox::Path::UsrSbin => {
if usr {
"../../bin/shitbox"
format!("../../bin/{progname}")
} else {
"../bin/shitbox"
format!("../bin/{progname}")
}
}
};
symlink(binpath, &linkpath)?;
symlink(&binpath, &linkpath)?;
println!(" symlink: {binpath} -> {}", linkpath.display());
} else {
let mut binpath = PathBuf::from(prefix);
binpath.push("bin");
binpath.push(env!("CARGO_PKG_NAME"));
println!("Generating link for {}", self.cli().get_name());
fs::hard_link(&binpath, &linkpath)?;
println!(" link: {} -> {}", binpath.display(), linkpath.display());
}
@ -269,13 +271,17 @@ impl BootstrapCmd for dyn Cmd {
Ok(())
}
fn manpage(&self, prefix: &str) -> Result<(), io::Error> {
fn manpage(&self, prefix: &str, usr: bool) -> Result<(), io::Error> {
let command = self.cli();
let fname = match command.get_name() {
"bootstrap" => "shitbox-bootstrap.1".to_string(),
"bootstrap" => format!("{}-bootstrap.1", shitbox::progname().unwrap()),
s => format!("{s}.1"),
};
let outdir: PathBuf = [prefix, "usr", "share", "man", "man1"].iter().collect();
let outdir: PathBuf = if usr {
[prefix, "usr", "share", "man", "man1"].iter().collect()
} else {
[prefix, "share", "man", "man1"].iter().collect()
};
if !outdir.exists() {
fs::create_dir_all(&outdir)?;
}
@ -290,48 +296,61 @@ impl BootstrapCmd for dyn Cmd {
}
}
fn manpages(prefix: &str) -> Result<(), io::Error> {
fn manpages(prefix: &str, usr: bool) -> Result<(), io::Error> {
println!("Generating Unix man pages:");
COMMANDS
.iter()
.try_for_each(|cmd| super::get(cmd).unwrap().manpage(prefix))?;
.try_for_each(|cmd| super::get(cmd).unwrap().manpage(prefix, usr))?;
Ok(())
}
fn completions(prefix: &str, matches: &ArgMatches) -> Result<(), io::Error> {
fn completions(prefix: &str, matches: &ArgMatches, usr: bool) -> Result<(), io::Error> {
println!("Generating completions:");
let basedir: PathBuf = if usr {
[prefix, "usr", "share"].iter().collect()
} else {
[prefix, "share"].iter().collect()
};
if matches.get_flag("bash") || matches.get_flag("all") {
let outdir: PathBuf = [prefix, "share", "bash-completion", "completion"]
.iter()
.collect();
let mut outdir = basedir.clone();
outdir.push("bash-completion");
outdir.push("completion");
COMMANDS.iter().try_for_each(|cmd| {
let cmd = super::get(cmd).unwrap();
cmd.completion(&outdir, "bash")
})?;
}
if matches.get_flag("fish") || matches.get_flag("all") {
let outdir: PathBuf = [prefix, "share", "fish", "completions"].iter().collect();
let mut outdir = basedir.clone();
outdir.push("fish");
outdir.push("completions");
COMMANDS.iter().try_for_each(|cmd| {
let cmd = super::get(cmd).unwrap();
cmd.completion(&outdir, "fish")
})?;
}
if matches.get_flag("nu") || matches.get_flag("all") {
let outdir: PathBuf = [prefix, "share", "nu", "completions"].iter().collect();
let mut outdir = basedir.clone();
outdir.push("nu");
outdir.push("completions");
COMMANDS.iter().try_for_each(|cmd| {
let cmd = super::get(cmd).unwrap();
cmd.completion(&outdir, "nu")
})?;
}
if matches.get_flag("pwsh") || matches.get_flag("all") {
let outdir: PathBuf = [prefix, "share", "pwsh", "completions"].iter().collect();
let mut outdir = basedir.clone();
outdir.push("pwsh");
outdir.push("completions");
COMMANDS.iter().try_for_each(|cmd| {
let cmd = super::get(cmd).unwrap();
cmd.completion(&outdir, "pwsh")
})?;
}
if matches.get_flag("zsh") || matches.get_flag("all") {
let outdir: PathBuf = [prefix, "share", "zsh", "site-functions"].iter().collect();
let mut outdir = basedir.clone();
outdir.push("zsh");
outdir.push("site-functions");
COMMANDS.iter().try_for_each(|cmd| {
let cmd = super::get(cmd).unwrap();
cmd.completion(&outdir, "zsh")

View File

@ -0,0 +1,397 @@
use super::{Cmd, COMMANDS};
use clap::{Arg, ArgAction, ArgMatches, Command};
use clap_complete::{generate_to, shells};
use clap_complete_nushell::Nushell;
use clap_mangen::Man;
use std::{
error::Error,
fs, io,
os::unix::fs::symlink,
path::{Path, PathBuf},
};
#[derive(Debug, Default)]
pub struct Bootstrap;
impl Bootstrap {
fn all() -> clap::Command {
Command::new("all").about("Install everything").args([
Arg::new("soft")
.help("Install soft links instead of hardlinks")
.short('s')
.long("soft")
.action(ArgAction::SetTrue),
Arg::new("all")
.help("Install completions for all supported shells")
.short('a')
.long("all")
.conflicts_with_all(["bash", "fish", "nu", "pwsh", "zsh"])
.action(ArgAction::SetTrue),
Arg::new("bash")
.help("Bash shell completions")
.short('b')
.long("bash")
.action(ArgAction::SetTrue),
Arg::new("fish")
.help("Fish shell completions")
.short('f')
.long("fish")
.action(ArgAction::SetTrue),
Arg::new("nu")
.help("Nushell completions")
.short('n')
.long("nu")
.action(ArgAction::SetTrue),
Arg::new("pwsh")
.help("PowerShell completions")
.short('p')
.long("pwsh")
.action(ArgAction::SetTrue),
Arg::new("zsh")
.help("Zshell completions")
.short('z')
.long("zsh")
.action(ArgAction::SetTrue),
])
}
fn links() -> clap::Command {
Command::new("links")
.about("Install links for each applet")
.arg(
Arg::new("soft")
.help("Install soft links instead of hardlinks")
.short('s')
.long("soft")
.action(ArgAction::SetTrue),
)
}
fn manpages() -> clap::Command {
Command::new("manpages")
.about("Install Unix man pages")
.alias("man")
}
fn completions() -> clap::Command {
Command::new("completions")
.about("Install shell completions")
.alias("comp")
.args([
Arg::new("all")
.help("Install completions for all supported shells")
.short('a')
.long("all")
.exclusive(true)
.action(ArgAction::SetTrue),
Arg::new("bash")
.help("Bash shell completions")
.short('b')
.long("bash")
.action(ArgAction::SetTrue),
Arg::new("fish")
.help("Fish shell completions")
.short('f')
.long("fish")
.action(ArgAction::SetTrue),
Arg::new("nu")
.help("Nushell completions")
.short('n')
.long("nu")
.action(ArgAction::SetTrue),
Arg::new("pwsh")
.help("PowerShell completions")
.short('p')
.long("pwsh")
.action(ArgAction::SetTrue),
Arg::new("zsh")
.help("Zshell completions")
.short('z')
.long("zsh")
.action(ArgAction::SetTrue),
])
}
}
impl Cmd for Bootstrap {
fn cli(&self) -> clap::Command {
Command::new("bootstrap")
.version(env!("CARGO_PKG_VERSION"))
.author("Nathan Fisher")
.about("Install shitbox into the filesystem")
.long_about("Install symlinks, manpages and shell completions")
.args([
Arg::new("prefix")
.help("The directory path under which to install")
.short('p')
.long("prefix")
.num_args(1)
.default_value("/")
.required(false),
Arg::new("usr")
.help("Use /usr")
.long_help(
"Split the installation so that some applets go into /bin | /sbin\n\
while others are placed into /usr/bin | /usr/sbin",
)
.short('u')
.long("usr")
.action(ArgAction::SetTrue),
Arg::new("soft")
.help("Install soft links instead of hardlinks")
.short('s')
.long("soft")
.action(ArgAction::SetTrue),
])
.subcommands([
Self::all(),
Self::links(),
Self::manpages(),
Self::completions(),
])
}
fn run(&self, matches: &ArgMatches) -> Result<(), Box<dyn Error>> {
if let Some(prefix) = matches.get_one::<String>("prefix") {
let usr = matches.get_flag("usr");
if let Some(progpath) = shitbox::progpath() {
let mut outpath = PathBuf::from(prefix);
outpath.push("bin");
println!("Installing binary:");
if !outpath.exists() {
fs::create_dir_all(&outpath)?;
println!(" mkdir: {}", outpath.display());
}
outpath.push(&shitbox::progname().unwrap());
fs::copy(&progpath, &outpath)?;
println!(
" install: {} -> {}",
progpath.display(),
outpath.display()
);
}
match matches.subcommand() {
Some(("links", matches)) => {
links(prefix, usr, matches)?;
}
Some(("manpages", _matches)) => {
manpages(prefix, usr)?;
}
Some(("completions", matches)) => {
completions(prefix, matches, usr)?;
}
Some(("all", matches)) => {
links(prefix, usr, matches)?;
manpages(prefix, usr)?;
completions(prefix, matches, usr)?;
}
_ => {}
}
}
Ok(())
}
fn path(&self) -> Option<shitbox::Path> {
None
}
}
#[allow(clippy::module_name_repetitions)]
pub trait BootstrapCmd {
fn completion(&self, outdir: &Path, gen: &str) -> Result<(), io::Error>;
fn linkpath(&self, prefix: &str, usr: bool) -> Option<PathBuf>;
fn link(&self, prefix: &str, usr: bool, soft: bool) -> Result<(), Box<dyn Error>>;
fn manpage(&self, prefix: &str, usr: bool) -> Result<(), io::Error>;
}
impl BootstrapCmd for dyn Cmd {
fn completion(&self, outdir: &Path, gen: &str) -> Result<(), io::Error> {
let cmd = self.cli();
let name = cmd.get_name();
let mut cmd = self.cli();
if !outdir.exists() {
fs::create_dir_all(outdir)?;
}
let path = match gen {
"bash" => generate_to(shells::Bash, &mut cmd, name, outdir)?,
"fish" => generate_to(shells::Fish, &mut cmd, name, outdir)?,
"nu" => generate_to(Nushell, &mut cmd, name, outdir)?,
"pwsh" => generate_to(shells::PowerShell, &mut cmd, name, outdir)?,
"zsh" => generate_to(shells::Zsh, &mut cmd, name, outdir)?,
_ => unimplemented!(),
};
println!(" {}", path.display());
Ok(())
}
fn linkpath(&self, prefix: &str, usr: bool) -> Option<PathBuf> {
let mut path = PathBuf::from(prefix);
let binpath = self.path();
match binpath {
Some(p) => path.push(p.to_str(usr)),
None => return None,
}
path.push(self.cli().get_name());
Some(path)
}
fn link(&self, prefix: &str, usr: bool, soft: bool) -> Result<(), Box<dyn Error>> {
if let Some(linkpath) = self.linkpath(prefix, usr) {
let progname = shitbox::progname().unwrap();
if soft {
let binpath = match self.path().unwrap() {
shitbox::Path::Bin => progname,
shitbox::Path::Sbin => format!("../bin/{progname}"),
shitbox::Path::UsrBin => {
if usr {
format!("../../bin/{progname}")
} else {
progname
}
}
shitbox::Path::UsrSbin => {
if usr {
format!("../../bin/{progname}")
} else {
format!("../bin/{progname}")
}
}
};
symlink(&binpath, &linkpath)?;
println!(" symlink: {binpath} -> {}", linkpath.display());
} else {
let mut binpath = PathBuf::from(prefix);
binpath.push("bin");
binpath.push(env!("CARGO_PKG_NAME"));
println!("Generating link for {}", self.cli().get_name());
fs::hard_link(&binpath, &linkpath)?;
println!(" link: {} -> {}", binpath.display(), linkpath.display());
}
}
Ok(())
}
fn manpage(&self, prefix: &str, usr: bool) -> Result<(), io::Error> {
let command = self.cli();
let fname = match command.get_name() {
"bootstrap" => format!("{}-bootstrap.1", shitbox::progname().unwrap()),
s => format!("{s}.1"),
};
let outdir: PathBuf = if usr {
[prefix, "usr", "share", "man", "man1"].iter().collect()
} else {
[prefix, "share", "man", "man1"].iter().collect()
};
if !outdir.exists() {
fs::create_dir_all(&outdir)?;
}
let mut outfile = outdir;
outfile.push(fname);
let man = Man::new(command);
let mut buffer: Vec<u8> = vec![];
man.render(&mut buffer)?;
fs::write(&outfile, buffer)?;
println!(" {}", outfile.display());
Ok(())
}
}
fn manpages(prefix: &str, usr: bool) -> Result<(), io::Error> {
println!("Generating Unix man pages:");
COMMANDS
.iter()
.try_for_each(|cmd| super::get(cmd).unwrap().manpage(prefix, usr))?;
Ok(())
}
fn completions(prefix: &str, matches: &ArgMatches, usr: bool) -> Result<(), io::Error> {
println!("Generating completions:");
let basedir: PathBuf = if usr {
[prefix, "usr", "share"].iter().collect()
} else {
[prefix, "share"].iter().collect()
};
if matches.get_flag("bash") || matches.get_flag("all") {
let mut outdir = basedir.clone();
outdir.push("bash-completion");
outdir.push("completion");
COMMANDS.iter().try_for_each(|cmd| {
let cmd = super::get(cmd).unwrap();
cmd.completion(&outdir, "bash")
})?;
}
if matches.get_flag("fish") || matches.get_flag("all") {
let mut outdir = basedir.clone();
outdir.push("fish");
outdir.push("completions");
COMMANDS.iter().try_for_each(|cmd| {
let cmd = super::get(cmd).unwrap();
cmd.completion(&outdir, "fish")
})?;
}
if matches.get_flag("nu") || matches.get_flag("all") {
let mut outdir = basedir.clone();
outdir.push("nu");
outdir.push("completions");
COMMANDS.iter().try_for_each(|cmd| {
let cmd = super::get(cmd).unwrap();
cmd.completion(&outdir, "nu")
})?;
}
if matches.get_flag("pwsh") || matches.get_flag("all") {
let mut outdir = basedir.clone();
outdir.push("pwsh");
outdir.push("completions");
COMMANDS.iter().try_for_each(|cmd| {
let cmd = super::get(cmd).unwrap();
cmd.completion(&outdir, "pwsh")
})?;
}
if matches.get_flag("zsh") || matches.get_flag("all") {
let mut outdir = basedir.clone();
outdir.push("zsh");
outdir.push("site-functions");
COMMANDS.iter().try_for_each(|cmd| {
let cmd = super::get(cmd).unwrap();
cmd.completion(&outdir, "zsh")
})?;
}
Ok(())
}
fn links(prefix: &str, usr: bool, cmd: &ArgMatches) -> Result<(), Box<dyn Error>> {
println!("Generating links:");
let mut binpath = PathBuf::from(prefix);
binpath.push("bin");
if !binpath.exists() {
fs::create_dir_all(&binpath)?;
println!(" mkdir: {}", binpath.display());
}
binpath.pop();
binpath.push("sbin");
if !binpath.exists() {
fs::create_dir_all(&binpath)?;
println!(" mkdir: {}", binpath.display());
}
if usr {
binpath.pop();
binpath.push("usr");
binpath.push("bin");
if !binpath.exists() {
fs::create_dir_all(&binpath)?;
println!(" mkdir: {}", binpath.display());
}
binpath.pop();
binpath.push("sbin");
if !binpath.exists() {
fs::create_dir_all(&binpath)?;
println!(" mkdir: {}", binpath.display());
}
}
let soft = cmd.get_flag("soft");
COMMANDS.iter().try_for_each(|c| {
let cmd = super::get(c).unwrap();
cmd.link(prefix, usr, soft)
})?;
Ok(())
}

View File

@ -1,6 +1,7 @@
use shitbox::Cmd;
mod b2sum;
mod bootstrap;
mod hashbox;
mod md5sum;
mod sha1sum;
@ -15,6 +16,7 @@ mod sha512sum;
pub fn get(name: &str) -> Option<Box<dyn Cmd>> {
match name {
"b2sum" => Some(Box::new(b2sum::B2sum::default())),
"bootstrap" => Some(Box::new(bootstrap::Bootstrap::default())),
"hashbox" => Some(Box::new(hashbox::Hashbox::default())),
"md5sum" => Some(Box::new(md5sum::Md5sum::default())),
"sha1sum" => Some(Box::new(sha1sum::Sha1sum::default())),
@ -26,8 +28,9 @@ pub fn get(name: &str) -> Option<Box<dyn Cmd>> {
}
}
pub static COMMANDS: [&str; 7] = [
pub static COMMANDS: [&str; 8] = [
"b2sum",
"bootstrap",
"md5sum",
"sha1sum",
"sha224sum",

1
pkg/bin/chgrp Symbolic link
View File

@ -0,0 +1 @@
corebox

1
pkg/bin/chmod Symbolic link
View File

@ -0,0 +1 @@
corebox

1
pkg/bin/chown Symbolic link
View File

@ -0,0 +1 @@
corebox

BIN
pkg/bin/corebox Executable file

Binary file not shown.

1
pkg/bin/echo Symbolic link
View File

@ -0,0 +1 @@
corebox

1
pkg/bin/false Symbolic link
View File

@ -0,0 +1 @@
corebox

BIN
pkg/bin/hashbox Executable file

Binary file not shown.

1
pkg/bin/head Symbolic link
View File

@ -0,0 +1 @@
corebox

1
pkg/bin/hostname Symbolic link
View File

@ -0,0 +1 @@
corebox

1
pkg/bin/ln Symbolic link
View File

@ -0,0 +1 @@
corebox

1
pkg/bin/mountpoint Symbolic link
View File

@ -0,0 +1 @@
utilbox

1
pkg/bin/realpath Symbolic link
View File

@ -0,0 +1 @@
corebox

1
pkg/bin/rm Symbolic link
View File

@ -0,0 +1 @@
corebox

1
pkg/bin/rmdir Symbolic link
View File

@ -0,0 +1 @@
corebox

1
pkg/bin/sleep Symbolic link
View File

@ -0,0 +1 @@
corebox

1
pkg/bin/sync Symbolic link
View File

@ -0,0 +1 @@
corebox

1
pkg/bin/true Symbolic link
View File

@ -0,0 +1 @@
corebox

1
pkg/bin/umount Symbolic link
View File

@ -0,0 +1 @@
utilbox

BIN
pkg/bin/utilbox Executable file

Binary file not shown.

1
pkg/sbin/mknod Symbolic link
View File

@ -0,0 +1 @@
../bin/corebox

1
pkg/sbin/nologin Symbolic link
View File

@ -0,0 +1 @@
../bin/corebox

1
pkg/sbin/swapoff Symbolic link
View File

@ -0,0 +1 @@
../bin/utilbox

1
pkg/usr/bin/b2sum Symbolic link
View File

@ -0,0 +1 @@
../../bin/hashbox

1
pkg/usr/bin/base32 Symbolic link
View File

@ -0,0 +1 @@
../../bin/corebox

1
pkg/usr/bin/base64 Symbolic link
View File

@ -0,0 +1 @@
../../bin/corebox

1
pkg/usr/bin/basename Symbolic link
View File

@ -0,0 +1 @@
../../bin/corebox

1
pkg/usr/bin/clear Symbolic link
View File

@ -0,0 +1 @@
../../bin/utilbox

1
pkg/usr/bin/cut Symbolic link
View File

@ -0,0 +1 @@
../../bin/corebox

1
pkg/usr/bin/dirname Symbolic link
View File

@ -0,0 +1 @@
../../bin/corebox

1
pkg/usr/bin/factor Symbolic link
View File

@ -0,0 +1 @@
../../bin/corebox

1
pkg/usr/bin/fold Symbolic link
View File

@ -0,0 +1 @@
../../bin/corebox

1
pkg/usr/bin/groups Symbolic link
View File

@ -0,0 +1 @@
../../bin/corebox

1
pkg/usr/bin/hostid Symbolic link
View File

@ -0,0 +1 @@
../../bin/corebox

1
pkg/usr/bin/link Symbolic link
View File

@ -0,0 +1 @@
../../bin/corebox

1
pkg/usr/bin/logname Symbolic link
View File

@ -0,0 +1 @@
../../bin/corebox

1
pkg/usr/bin/md5sum Symbolic link
View File

@ -0,0 +1 @@
../../bin/hashbox

1
pkg/usr/bin/mkfifo Symbolic link
View File

@ -0,0 +1 @@
../../bin/corebox

1
pkg/usr/bin/mktemp Symbolic link
View File

@ -0,0 +1 @@
../../bin/corebox

1
pkg/usr/bin/nproc Symbolic link
View File

@ -0,0 +1 @@
../../bin/corebox

1
pkg/usr/bin/printenv Symbolic link
View File

@ -0,0 +1 @@
../../bin/corebox

1
pkg/usr/bin/pwd Symbolic link
View File

@ -0,0 +1 @@
../../bin/corebox

1
pkg/usr/bin/readlink Symbolic link
View File

@ -0,0 +1 @@
../../bin/corebox

1
pkg/usr/bin/rev Symbolic link
View File

@ -0,0 +1 @@
../../bin/corebox

1
pkg/usr/bin/sha1sum Symbolic link
View File

@ -0,0 +1 @@
../../bin/hashbox

1
pkg/usr/bin/sha224sum Symbolic link
View File

@ -0,0 +1 @@
../../bin/hashbox

1
pkg/usr/bin/sha256sum Symbolic link
View File

@ -0,0 +1 @@
../../bin/hashbox

1
pkg/usr/bin/sha384sum Symbolic link
View File

@ -0,0 +1 @@
../../bin/hashbox

1
pkg/usr/bin/sha512sum Symbolic link
View File

@ -0,0 +1 @@
../../bin/hashbox

1
pkg/usr/bin/unlink Symbolic link
View File

@ -0,0 +1 @@
../../bin/corebox

1
pkg/usr/bin/wc Symbolic link
View File

@ -0,0 +1 @@
../../bin/corebox

1
pkg/usr/bin/which Symbolic link
View File

@ -0,0 +1 @@
../../bin/corebox

1
pkg/usr/bin/whoami Symbolic link
View File

@ -0,0 +1 @@
../../bin/corebox

1
pkg/usr/bin/yes Symbolic link
View File

@ -0,0 +1 @@
../../bin/corebox

1
pkg/usr/sbin/chroot Symbolic link
View File

@ -0,0 +1 @@
../../bin/corebox

1
pkg/usr/sbin/swaplabel Symbolic link
View File

@ -0,0 +1 @@
../../bin/utilbox

View File

@ -0,0 +1,46 @@
_b2sum() {
local i cur prev opts cmd
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
cmd=""
opts=""
for i in ${COMP_WORDS[@]}
do
case "${cmd},${i}" in
",$1")
cmd="b2sum"
;;
*)
;;
esac
done
case "${cmd}" in
b2sum)
opts="-c -l -h -V --check --length --help --version [FILE]..."
if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
--length)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
-l)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
esac
}
complete -F _b2sum -o bashdefault -o default b2sum

View File

@ -0,0 +1,54 @@
_base32() {
local i cur prev opts cmd
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
cmd=""
opts=""
for i in ${COMP_WORDS[@]}
do
case "${cmd},${i}" in
",$1")
cmd="base32"
;;
*)
;;
esac
done
case "${cmd}" in
base32)
opts="-d -i -w -c -v -q -h --decode --ignore-space --wrap --color --verbose --quiet --help [FILE]..."
if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
--wrap)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
-w)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
--color)
COMPREPLY=($(compgen -W "always ansi auto never" -- "${cur}"))
return 0
;;
-c)
COMPREPLY=($(compgen -W "always ansi auto never" -- "${cur}"))
return 0
;;
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
esac
}
complete -F _base32 -o bashdefault -o default base32

View File

@ -0,0 +1,54 @@
_base64() {
local i cur prev opts cmd
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
cmd=""
opts=""
for i in ${COMP_WORDS[@]}
do
case "${cmd},${i}" in
",$1")
cmd="base64"
;;
*)
;;
esac
done
case "${cmd}" in
base64)
opts="-d -i -w -c -v -q -h --decode --ignore-space --wrap --color --verbose --quiet --help [FILE]..."
if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
--wrap)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
-w)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
--color)
COMPREPLY=($(compgen -W "always ansi auto never" -- "${cur}"))
return 0
;;
-c)
COMPREPLY=($(compgen -W "always ansi auto never" -- "${cur}"))
return 0
;;
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
esac
}
complete -F _base64 -o bashdefault -o default base64

View File

@ -0,0 +1,38 @@
_basename() {
local i cur prev opts cmd
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
cmd=""
opts=""
for i in ${COMP_WORDS[@]}
do
case "${cmd},${i}" in
",$1")
cmd="basename"
;;
*)
;;
esac
done
case "${cmd}" in
basename)
opts="-h --help <NAME> [SUFFIX]"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
esac
}
complete -F _basename -o bashdefault -o default basename

View File

@ -0,0 +1,216 @@
_bootstrap() {
local i cur prev opts cmd
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
cmd=""
opts=""
for i in ${COMP_WORDS[@]}
do
case "${cmd},${i}" in
",$1")
cmd="bootstrap"
;;
bootstrap,all)
cmd="bootstrap__all"
;;
bootstrap,completions)
cmd="bootstrap__completions"
;;
bootstrap,help)
cmd="bootstrap__help"
;;
bootstrap,links)
cmd="bootstrap__links"
;;
bootstrap,manpages)
cmd="bootstrap__manpages"
;;
bootstrap__help,all)
cmd="bootstrap__help__all"
;;
bootstrap__help,completions)
cmd="bootstrap__help__completions"
;;
bootstrap__help,help)
cmd="bootstrap__help__help"
;;
bootstrap__help,links)
cmd="bootstrap__help__links"
;;
bootstrap__help,manpages)
cmd="bootstrap__help__manpages"
;;
*)
;;
esac
done
case "${cmd}" in
bootstrap)
opts="-p -u -s -h -V --prefix --usr --soft --help --version all links manpages completions help"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
--prefix)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
-p)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
bootstrap__all)
opts="-s -a -b -f -n -p -z -h --soft --all --bash --fish --nu --pwsh --zsh --help"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
bootstrap__completions)
opts="-a -b -f -n -p -z -h --all --bash --fish --nu --pwsh --zsh --help"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
bootstrap__help)
opts="all links manpages completions help"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
bootstrap__help__all)
opts=""
if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
bootstrap__help__completions)
opts=""
if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
bootstrap__help__help)
opts=""
if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
bootstrap__help__links)
opts=""
if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
bootstrap__help__manpages)
opts=""
if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
bootstrap__links)
opts="-s -h --soft --help"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
bootstrap__manpages)
opts="-h --help"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
esac
}
complete -F _bootstrap -o bashdefault -o default bootstrap

View File

@ -0,0 +1,38 @@
_chgrp() {
local i cur prev opts cmd
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
cmd=""
opts=""
for i in ${COMP_WORDS[@]}
do
case "${cmd},${i}" in
",$1")
cmd="chgrp"
;;
*)
;;
esac
done
case "${cmd}" in
chgrp)
opts="-c -v -R -H -L -P -s -h -V --changes --verbose --recursive --same-filesystem --help --version <GROUP> <FILE>..."
if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
esac
}
complete -F _chgrp -o bashdefault -o default chgrp

View File

@ -0,0 +1,38 @@
_chmod() {
local i cur prev opts cmd
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
cmd=""
opts=""
for i in ${COMP_WORDS[@]}
do
case "${cmd},${i}" in
",$1")
cmd="chmod"
;;
*)
;;
esac
done
case "${cmd}" in
chmod)
opts="-v -c -f -R -h -V --verbose --changes --quiet --silent --recursive --help --version <MODE> <FILE>..."
if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
esac
}
complete -F _chmod -o bashdefault -o default chmod

View File

@ -0,0 +1,38 @@
_chown() {
local i cur prev opts cmd
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
cmd=""
opts=""
for i in ${COMP_WORDS[@]}
do
case "${cmd},${i}" in
",$1")
cmd="chown"
;;
*)
;;
esac
done
case "${cmd}" in
chown)
opts="-c -v -R -H -L -P -s -h -V --changes --verbose --recursive --same-filesystem --help --version <OWNER[:GROUP]> <FILE>..."
if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
esac
}
complete -F _chown -o bashdefault -o default chown

View File

@ -0,0 +1,46 @@
_chroot() {
local i cur prev opts cmd
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
cmd=""
opts=""
for i in ${COMP_WORDS[@]}
do
case "${cmd},${i}" in
",$1")
cmd="chroot"
;;
*)
;;
esac
done
case "${cmd}" in
chroot)
opts="-d -h -V --directory --help --version <NEWROOT> [COMMAND] [ARG]..."
if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
--directory)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
-d)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
esac
}
complete -F _chroot -o bashdefault -o default chroot

View File

@ -0,0 +1,38 @@
_clear() {
local i cur prev opts cmd
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
cmd=""
opts=""
for i in ${COMP_WORDS[@]}
do
case "${cmd},${i}" in
",$1")
cmd="clear"
;;
*)
;;
esac
done
case "${cmd}" in
clear)
opts="-h -V --help --version"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
esac
}
complete -F _clear -o bashdefault -o default clear

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,74 @@
_cut() {
local i cur prev opts cmd
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
cmd=""
opts=""
for i in ${COMP_WORDS[@]}
do
case "${cmd},${i}" in
",$1")
cmd="cut"
;;
*)
;;
esac
done
case "${cmd}" in
cut)
opts="-b -c -f -d -n -s -h -V --bytes --characters --fields --delimiter --only-delimited --help --version [FILE]..."
if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
--bytes)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
-b)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
--characters)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
-c)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
--fields)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
-f)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
--delimiter)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
-d)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
-n)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
esac
}
complete -F _cut -o bashdefault -o default cut

View File

@ -0,0 +1,38 @@
_dirname() {
local i cur prev opts cmd
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
cmd=""
opts=""
for i in ${COMP_WORDS[@]}
do
case "${cmd},${i}" in
",$1")
cmd="dirname"
;;
*)
;;
esac
done
case "${cmd}" in
dirname)
opts="-z -h --zero --help <name>..."
if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
esac
}
complete -F _dirname -o bashdefault -o default dirname

View File

@ -0,0 +1,42 @@
_echo() {
local i cur prev opts cmd
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
cmd=""
opts=""
for i in ${COMP_WORDS[@]}
do
case "${cmd},${i}" in
",$1")
cmd="echo"
;;
*)
;;
esac
done
case "${cmd}" in
echo)
opts="-n -h --help [STRING]..."
if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
-n)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
esac
}
complete -F _echo -o bashdefault -o default echo

View File

@ -0,0 +1,38 @@
_factor() {
local i cur prev opts cmd
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
cmd=""
opts=""
for i in ${COMP_WORDS[@]}
do
case "${cmd},${i}" in
",$1")
cmd="factor"
;;
*)
;;
esac
done
case "${cmd}" in
factor)
opts="-h --help [number]..."
if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
esac
}
complete -F _factor -o bashdefault -o default factor

View File

@ -0,0 +1,38 @@
_false() {
local i cur prev opts cmd
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
cmd=""
opts=""
for i in ${COMP_WORDS[@]}
do
case "${cmd},${i}" in
",$1")
cmd="false"
;;
*)
;;
esac
done
case "${cmd}" in
false)
opts="-h --help"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
esac
}
complete -F _false -o bashdefault -o default false

View File

@ -0,0 +1,46 @@
_fold() {
local i cur prev opts cmd
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
cmd=""
opts=""
for i in ${COMP_WORDS[@]}
do
case "${cmd},${i}" in
",$1")
cmd="fold"
;;
*)
;;
esac
done
case "${cmd}" in
fold)
opts="-b -s -o -w -h --bytes --spaces --optimal --width --help [FILE]..."
if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
--width)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
-w)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
esac
}
complete -F _fold -o bashdefault -o default fold

View File

@ -0,0 +1,38 @@
_groups() {
local i cur prev opts cmd
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
cmd=""
opts=""
for i in ${COMP_WORDS[@]}
do
case "${cmd},${i}" in
",$1")
cmd="groups"
;;
*)
;;
esac
done
case "${cmd}" in
groups)
opts="-h -V --help --version [user]"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
esac
}
complete -F _groups -o bashdefault -o default groups

View File

@ -0,0 +1,58 @@
_head() {
local i cur prev opts cmd
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
cmd=""
opts=""
for i in ${COMP_WORDS[@]}
do
case "${cmd},${i}" in
",$1")
cmd="head"
;;
*)
;;
esac
done
case "${cmd}" in
head)
opts="-c -q -v -n -C -1 -h --bytes --quiet --verbose --lines --color --help [FILES]..."
if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
--lines)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
-n)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
--color)
COMPREPLY=($(compgen -W "always ansi auto never" -- "${cur}"))
return 0
;;
-C)
COMPREPLY=($(compgen -W "always ansi auto never" -- "${cur}"))
return 0
;;
-1)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
esac
}
complete -F _head -o bashdefault -o default head

View File

@ -0,0 +1,38 @@
_hostid() {
local i cur prev opts cmd
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
cmd=""
opts=""
for i in ${COMP_WORDS[@]}
do
case "${cmd},${i}" in
",$1")
cmd="hostid"
;;
*)
;;
esac
done
case "${cmd}" in
hostid)
opts="-h -V --help --version"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
esac
}
complete -F _hostid -o bashdefault -o default hostid

View File

@ -0,0 +1,38 @@
_hostname() {
local i cur prev opts cmd
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
cmd=""
opts=""
for i in ${COMP_WORDS[@]}
do
case "${cmd},${i}" in
",$1")
cmd="hostname"
;;
*)
;;
esac
done
case "${cmd}" in
hostname)
opts="-s -h --strip --help [NAME]"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
esac
}
complete -F _hostname -o bashdefault -o default hostname

View File

@ -0,0 +1,38 @@
_link() {
local i cur prev opts cmd
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
cmd=""
opts=""
for i in ${COMP_WORDS[@]}
do
case "${cmd},${i}" in
",$1")
cmd="link"
;;
*)
;;
esac
done
case "${cmd}" in
link)
opts="-v -h -V --verbose --help --version <file1> <file2>"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
esac
}
complete -F _link -o bashdefault -o default link

View File

@ -0,0 +1,38 @@
_ln() {
local i cur prev opts cmd
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
cmd=""
opts=""
for i in ${COMP_WORDS[@]}
do
case "${cmd},${i}" in
",$1")
cmd="ln"
;;
*)
;;
esac
done
case "${cmd}" in
ln)
opts="-f -s -v -L -P -h -V --force --symbolic --verbose --help --version <source>... <dest>"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
esac
}
complete -F _ln -o bashdefault -o default ln

View File

@ -0,0 +1,38 @@
_logname() {
local i cur prev opts cmd
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
cmd=""
opts=""
for i in ${COMP_WORDS[@]}
do
case "${cmd},${i}" in
",$1")
cmd="logname"
;;
*)
;;
esac
done
case "${cmd}" in
logname)
opts="-h -V --help --version"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
esac
}
complete -F _logname -o bashdefault -o default logname

View File

@ -0,0 +1,38 @@
_md5sum() {
local i cur prev opts cmd
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
cmd=""
opts=""
for i in ${COMP_WORDS[@]}
do
case "${cmd},${i}" in
",$1")
cmd="md5sum"
;;
*)
;;
esac
done
case "${cmd}" in
md5sum)
opts="-c -h -V --check --help --version [FILE]..."
if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
esac
}
complete -F _md5sum -o bashdefault -o default md5sum

View File

@ -0,0 +1,46 @@
_mkfifo() {
local i cur prev opts cmd
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
cmd=""
opts=""
for i in ${COMP_WORDS[@]}
do
case "${cmd},${i}" in
",$1")
cmd="mkfifo"
;;
*)
;;
esac
done
case "${cmd}" in
mkfifo)
opts="-m -v -h -V --mode --verbose --help --version <file>..."
if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
--mode)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
-m)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
esac
}
complete -F _mkfifo -o bashdefault -o default mkfifo

View File

@ -0,0 +1,46 @@
_mknod() {
local i cur prev opts cmd
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
cmd=""
opts=""
for i in ${COMP_WORDS[@]}
do
case "${cmd},${i}" in
",$1")
cmd="mknod"
;;
*)
;;
esac
done
case "${cmd}" in
mknod)
opts="-m -v -h -V --mode --verbose --help --version <NAME> b c p [MAJOR] [MINOR]"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
--mode)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
-m)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
esac
}
complete -F _mknod -o bashdefault -o default mknod

View File

@ -0,0 +1,54 @@
_mktemp() {
local i cur prev opts cmd
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
cmd=""
opts=""
for i in ${COMP_WORDS[@]}
do
case "${cmd},${i}" in
",$1")
cmd="mktemp"
;;
*)
;;
esac
done
case "${cmd}" in
mktemp)
opts="-d -p -t -u -h -V --directory --tmpdir --template --dryrun --help --version"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
--tmpdir)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
-p)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
--template)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
-t)
COMPREPLY=($(compgen -f "${cur}"))
return 0
;;
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
esac
}
complete -F _mktemp -o bashdefault -o default mktemp

View File

@ -0,0 +1,38 @@
_mountpoint() {
local i cur prev opts cmd
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
cmd=""
opts=""
for i in ${COMP_WORDS[@]}
do
case "${cmd},${i}" in
",$1")
cmd="mountpoint"
;;
*)
;;
esac
done
case "${cmd}" in
mountpoint)
opts="-d -x -q -h --fs-devno --devno --quiet --help <file>"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
esac
}
complete -F _mountpoint -o bashdefault -o default mountpoint

View File

@ -0,0 +1,38 @@
_nologin() {
local i cur prev opts cmd
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
cmd=""
opts=""
for i in ${COMP_WORDS[@]}
do
case "${cmd},${i}" in
",$1")
cmd="nologin"
;;
*)
;;
esac
done
case "${cmd}" in
nologin)
opts="-h --help"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
esac
}
complete -F _nologin -o bashdefault -o default nologin

View File

@ -0,0 +1,38 @@
_nproc() {
local i cur prev opts cmd
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
cmd=""
opts=""
for i in ${COMP_WORDS[@]}
do
case "${cmd},${i}" in
",$1")
cmd="nproc"
;;
*)
;;
esac
done
case "${cmd}" in
nproc)
opts="-a -h --all --help"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
esac
}
complete -F _nproc -o bashdefault -o default nproc

View File

@ -0,0 +1,38 @@
_printenv() {
local i cur prev opts cmd
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
cmd=""
opts=""
for i in ${COMP_WORDS[@]}
do
case "${cmd},${i}" in
",$1")
cmd="printenv"
;;
*)
;;
esac
done
case "${cmd}" in
printenv)
opts="-0 -h -V --null --help --version [VARIABLE]..."
if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
esac
}
complete -F _printenv -o bashdefault -o default printenv

View File

@ -0,0 +1,38 @@
_pwd() {
local i cur prev opts cmd
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
cmd=""
opts=""
for i in ${COMP_WORDS[@]}
do
case "${cmd},${i}" in
",$1")
cmd="pwd"
;;
*)
;;
esac
done
case "${cmd}" in
pwd)
opts="-L -P -h -V --logical --physical --help --version"
if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
esac
}
complete -F _pwd -o bashdefault -o default pwd

View File

@ -0,0 +1,38 @@
_readlink() {
local i cur prev opts cmd
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
cmd=""
opts=""
for i in ${COMP_WORDS[@]}
do
case "${cmd},${i}" in
",$1")
cmd="readlink"
;;
*)
;;
esac
done
case "${cmd}" in
readlink)
opts="-c -f -n -h -V --canonicalize --no-newline --help --version <PATH>..."
if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
esac
}
complete -F _readlink -o bashdefault -o default readlink

View File

@ -0,0 +1,38 @@
_realpath() {
local i cur prev opts cmd
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
cmd=""
opts=""
for i in ${COMP_WORDS[@]}
do
case "${cmd},${i}" in
",$1")
cmd="realpath"
;;
*)
;;
esac
done
case "${cmd}" in
realpath)
opts="-q -h -V --quiet --help --version [path]..."
if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
esac
}
complete -F _realpath -o bashdefault -o default realpath

View File

@ -0,0 +1,46 @@
_rev() {
local i cur prev opts cmd
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
cmd=""
opts=""
for i in ${COMP_WORDS[@]}
do
case "${cmd},${i}" in
",$1")
cmd="rev"
;;
*)
;;
esac
done
case "${cmd}" in
rev)
opts="-v -c -h --verbose --color --help [FILE]..."
if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
--color)
COMPREPLY=($(compgen -W "always ansi auto never" -- "${cur}"))
return 0
;;
-c)
COMPREPLY=($(compgen -W "always ansi auto never" -- "${cur}"))
return 0
;;
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
esac
}
complete -F _rev -o bashdefault -o default rev

View File

@ -0,0 +1,42 @@
_rm() {
local i cur prev opts cmd
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
cmd=""
opts=""
for i in ${COMP_WORDS[@]}
do
case "${cmd},${i}" in
",$1")
cmd="rm"
;;
*)
;;
esac
done
case "${cmd}" in
rm)
opts="-i -I -f -R -v -h -V --interactive --force --recursive --verbose --help --version <FILE>..."
if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
--interactive)
COMPREPLY=($(compgen -W "never once always" -- "${cur}"))
return 0
;;
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
esac
}
complete -F _rm -o bashdefault -o default rm

View File

@ -0,0 +1,38 @@
_rmdir() {
local i cur prev opts cmd
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
cmd=""
opts=""
for i in ${COMP_WORDS[@]}
do
case "${cmd},${i}" in
",$1")
cmd="rmdir"
;;
*)
;;
esac
done
case "${cmd}" in
rmdir)
opts="-p -v -h -V --parents --verbose --help --version <DIRECTORY>..."
if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
esac
}
complete -F _rmdir -o bashdefault -o default rmdir

View File

@ -0,0 +1,38 @@
_sha1sum() {
local i cur prev opts cmd
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
cmd=""
opts=""
for i in ${COMP_WORDS[@]}
do
case "${cmd},${i}" in
",$1")
cmd="sha1sum"
;;
*)
;;
esac
done
case "${cmd}" in
sha1sum)
opts="-c -h -V --check --help --version [FILE]..."
if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
esac
}
complete -F _sha1sum -o bashdefault -o default sha1sum

View File

@ -0,0 +1,38 @@
_sha224sum() {
local i cur prev opts cmd
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
cmd=""
opts=""
for i in ${COMP_WORDS[@]}
do
case "${cmd},${i}" in
",$1")
cmd="sha224sum"
;;
*)
;;
esac
done
case "${cmd}" in
sha224sum)
opts="-c -h -V --check --help --version [FILE]..."
if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
esac
}
complete -F _sha224sum -o bashdefault -o default sha224sum

View File

@ -0,0 +1,38 @@
_sha256sum() {
local i cur prev opts cmd
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
cmd=""
opts=""
for i in ${COMP_WORDS[@]}
do
case "${cmd},${i}" in
",$1")
cmd="sha256sum"
;;
*)
;;
esac
done
case "${cmd}" in
sha256sum)
opts="-c -h -V --check --help --version [FILE]..."
if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
esac
}
complete -F _sha256sum -o bashdefault -o default sha256sum

View File

@ -0,0 +1,38 @@
_sha384sum() {
local i cur prev opts cmd
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
cmd=""
opts=""
for i in ${COMP_WORDS[@]}
do
case "${cmd},${i}" in
",$1")
cmd="sha384sum"
;;
*)
;;
esac
done
case "${cmd}" in
sha384sum)
opts="-c -h -V --check --help --version [FILE]..."
if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
fi
case "${prev}" in
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0
;;
esac
}
complete -F _sha384sum -o bashdefault -o default sha384sum

Some files were not shown because too many files have changed in this diff Show More