/// Concatenate FILE(s) to standard output.
cmd Main("cat") {
/// With no FILE, or when FILE is -, read standard input.
arg FileToDisplay(..) => List<Path> [
requires FileExists
]
/// equivalent to -vET
opt ShowAll("A", "show-all") => Bool
/// number nonempty output lines, overrides -n
opt NumberNonBlank("b", "number-nonblank") => Bool
/// equivalent to -vE
opt NonPrintingEnds("e") => Bool
/// display $ at end of each line
opt ShowEnds("E", "show-ends") => Bool
/// number all output lines
opt Number("n", "number") => Bool
/// suppress repeated empty output lines
opt SqueezeBlank("s", "squeeze-blank") => Bool
/// equivalent to -vT
opt NonPrintingAndTabs("t") => Bool
/// display TAB characters as ^I
opt ShowTabs("T", "show-tabs") => Bool
/// (ignored)
opt Ignored("u") => Bool
/// use ^ and M- notation, except for LFD and TAB
opt ShowNonPrinting("v", "show-nonprinting") => Bool
/// display this help and exit
opt Help("help") => Bool [
excludes All
]
/// output version information and exit
opt Version("version") => Bool [
excludes All
]
}
cmd Main("cp") [
requires Sources
requires Dest | TargetDirectory
] {
/// source files or directories to copy
arg Sources(0..-1) => List<Path> [
requires FileExists | DirExists
]
/// destination file or directory (the last positional argument,
/// omitted when -t is used)
arg Dest(-1) => Path [
ensures FileExists
excludes TargetDirectory
]
/// treat DEST as a normal file, never as a directory; only valid
/// when exactly one source is given
opt NoTargetDirectory("T", "no-target-directory") => Bool [
excludes TargetDirectory
]
/// copy all SOURCE arguments into DIRECTORY instead of using the
/// last positional as the destination
opt TargetDirectory("t", "target-directory") => Path [
requires DirExists
excludes NoTargetDirectory
]
/// copy directories (and their contents) recursively
opt Recursive("r", "R", "recursive") => Bool
/// archive mode: preserve all attributes and copy recursively
/// (equivalent to -dR --preserve=all)
opt Archive("a", "archive") => Bool
/// hard link files instead of copying them
opt Link("l", "link") => Bool [
excludes SymbolicLink
]
/// make symbolic links instead of copying
opt SymbolicLink("s", "symbolic-link") => Bool [
excludes Link
]
/// copy only when SOURCE is newer than DEST, or DEST is missing;
/// UPDATE controls which files are replaced
opt Update("update") => "all" | "none" | "none-fail" | "older" [
@default("older")
]
/// equivalent to --update=older
opt UpdateOlder("u") => Bool
/// (deprecated) silently skip existing destination files;
/// prefer --update=none instead
opt NoClobber("n", "no-clobber") => Bool
/// only copy file attributes, not file data
opt AttributesOnly("attributes-only") => Bool
/// copy contents of special files (e.g. device nodes) when recursive
opt CopyContents("copy-contents") => Bool [
requires Recursive
]
/// use full source file name (rooted path) under the target DIRECTORY,
/// creating intermediate directories as needed
opt Parents("parents") => Bool [
requires TargetDirectory | Dest
]
/// remove trailing slashes from each SOURCE argument before processing
opt StripTrailingSlashes("strip-trailing-slashes") => Bool
/// follow symbolic links listed on the command line in SOURCE
/// (command-line symlinks only; others are not followed)
opt FollowCliLinks("H") => Bool [
excludes Dereference
excludes NoDereference
]
/// always follow symbolic links in SOURCE (dereference all)
opt Dereference("L", "dereference") => Bool [
excludes NoDereference
excludes FollowCliLinks
]
/// never follow symbolic links in SOURCE; copy the symlink itself
opt NoDereference("P", "no-dereference") => Bool [
excludes Dereference
excludes FollowCliLinks
]
/// follow existing symlinks to directories at the destination
opt KeepDirectorySymlink("keep-directory-symlink") => Bool
type FileAttributes => "mode" | "ownership" | "timestamps" | "links" | "context" | "xattr" | "all"
/// preserve the specified file attributes (default: mode, ownership,
/// timestamps); additional attrs: links, context, xattr, all
opt Preserve("preserve") => List<FileAttributes> [
@default(["mode", "ownership", "timestamps"])
]
/// shorthand for --preserve=mode,ownership,timestamps
opt PreserveBasic("p") => Bool
/// do not preserve the specified attributes
opt NoPreserve("no-preserve") => List<FileAttributes>
type BackupKind => "none" | "off" | "numbered" | "t" | "existing" | "nil" | "simple" | "never"
/// make a backup of each existing destination file; CONTROL selects
/// the versioning scheme
opt Backup("backup") => BackupKind [
@default("existing")
]
/// like --backup but always uses the simple scheme and takes no argument
opt BackupSimple("b") => Bool
/// override the default backup suffix (~)
opt Suffix("S", "suffix") => String
type BehaviourKind => "auto" | "always" | "never"
/// control copy-on-write / clone behaviour
opt Reflink("reflink") => BehaviourKind [
@default("auto")
]
/// control creation of sparse files in the destination
opt Sparse("sparse") => BehaviourKind [
@default("auto")
]
/// do not cross filesystem boundaries (stay on the same device)
opt OneFileSystem("x", "one-file-system") => Bool
/// remove each existing destination file before opening it
/// (contrast with --force, which removes only when open fails)
opt RemoveDestination("remove-destination") => Bool [
excludes Force
]
/// if an existing destination file cannot be opened, remove it
/// and try again (ignored when -n is also used)
opt Force("f", "force") => Bool [
excludes RemoveDestination
]
/// prompt before every overwrite
opt Interactive("i", "interactive") => Bool [
excludes NoClobber
]
/// set the SELinux security context of the destination to the default type
opt SelinuxDefault("Z") => Bool [
excludes Context
]
/// set the SELinux or SMACK security context of the destination;
/// without CTX, behaves like -Z
opt Context("context") => String [
excludes SelinuxDefault
]
/// explain what is being done
opt Verbose("v", "verbose") => Bool
/// explain how each file is copied (implies -v)
opt Debug("debug") => Bool
/// display help and exit
opt Help("help") => Bool [
excludes All
]
/// output version information and exit
opt Version("version") => Bool [
excludes All
]
}
cmd Main("echo") [
] {
/// strings to be written to standard output
arg PrintText(..) => List<String>
/// do not output the trailing newline
opt NoNewline("n") => Bool
/// enable interpretation of backslash escapes
opt EnableEscapes("e") => Bool
/// disable interpretation of backslash escapes (default)
opt DisableEscapes("E") => Bool
}
cmd Main("head") [
requires InputFiles
] {
// Print the first 10 lines of each FILE to standard output. With more than one FILE,
// precede each with a header giving the file name.
arg InputFiles(..) => List<File> [
requires FileExists
ensures StdOut
]
// NUM may have a multiplier suffix: b 512, kB 1000, K 1024, MB 1000*1000, M 1024*1024,
// GB 1000*1000*1000, G 1024*1024*1024, and so on for T, P, E, Z, Y, R, Q. Binary prefixes
// can be used, too: KiB=K, MiB=M, and so on.
type SuffixKind => "b" | "kB" | "K" | "MB" | "M" | "GB" | "G" | "T" | "P" | "E" | "Z" | "Y" | "R" | "Q"
// print the first NUM bytes of each file; with the leading '-', print all but the last NUM
// bytes of each file
opt Bytes("c", "bytes") => String
// print the first NUM lines instead of the first 10; with the leading '-', print all but the last NUM lines
// of each file
opt Lines("n", "lines") => String
// never print headers giving file names
opt Quiet("q", "quiet", "silent") => Bool
// always print headers giving file names
opt Verbose("v", "verbose") => Bool
// line delimiter is NUL, not newline
opt Verbose("z", "zero-terminated") => Bool
// display this help and exit
opt Verbose("help") => Bool
// output version information and exit
opt Verbose("version") => Bool
}
cmd Main("ls") {
/// files or directories to list (defaults to current directory)
arg Files(..) => List<Path> [
@default(".")
]
/// do not ignore entries starting with .
opt All("a", "all") => Bool
/// do not list implied . and ..
opt AlmostAll("A", "almost-all") => Bool
/// with -l, print the author of each file
opt Author("author") => Bool
/// print C-style escapes for nongraphic characters
opt Escape("b", "escape") => Bool
/// with -l, scale sizes by SIZE when printing them (e.g. '--block-size=M')
opt BlockSize("block-size") => String
/// do not list implied entries ending with ~
opt IgnoreBackups("B", "ignore-backups") => Bool
/// with -lt: sort by, and show, ctime; with -l: show ctime and sort by name;
/// otherwise: sort by ctime, newest first
opt Ctime("c") => Bool
/// list entries by columns
opt Columns("C") => Bool
type WhenSpecifier => "always" | "auto" | "never"
/// color the output WHEN
opt Color("color") => WhenSpecifier [
@default("always")
]
/// list directories themselves, not their contents
opt Directory("d", "directory") => Bool
/// generate output designed for Emacs' dired mode
opt Dired("D", "dired") => Bool
/// list all entries in directory order (do not sort)
opt UnsortedAll("f") => Bool
/// append indicator (one of */=>@|) to entries WHEN
opt Classify("F", "classify") => WhenSpecifier [
@default("always")
]
/// append indicator to entries, except do not append '*'
opt FileType("file-type") => Bool
/// across -x, commas -m, horizontal -x, long -l, single-column -1, verbose -l, vertical -C
opt Format("format") => "across" | "commas" | "horizontal" | "long" | "single-column" | "verbose" | "vertical"
/// like -l --time-style=full-iso
opt FullTime("full-time") => Bool
/// like -l, but do not list owner
opt NoOwner("g") => Bool
/// group directories before files
opt GroupDirectoriesFirst("group-directories-first") => Bool
/// in a long listing, do not print group names
opt NoGroup("G", "no-group") => Bool
/// with -l and -s, print sizes in human readable form (e.g. 1K 234M 2G)
opt HumanReadable("h", "human-readable") => Bool
/// do not list implied entries matching shell PATTERN (overridden by -a or -A)
opt Hide("hide") => String
/// likewise, but use powers of 1000 not 1024
opt Si("si") => Bool
/// follow symbolic links listed on the command line
opt DereferenceCommandLine("H", "dereference-command-line") => Bool
/// follow each command line symbolic link that points to a directory
opt DereferenceCommandLineSymlinkToDir("dereference-command-line-symlink-to-dir") => Bool
/// hyperlink file names WHEN
opt Hyperlink("hyperlink") => WhenSpecifier [
@default("always")
]
/// append indicator with style WORD to entry names
opt IndicatorStyle("indicator-style") => "none" | "slash" | "file-type" | "classify" [
@default("none")
]
/// print the index number of each file
opt Inode("i", "inode") => Bool
/// do not list implied entries matching shell PATTERN
opt Ignore("I", "ignore") => String
/// default to 1024-byte blocks for disk usage; used only with -s
opt Kibibytes("k", "kibibytes") => Bool
/// use a long listing format
opt Long("l") => Bool
/// when showing file info for a symbolic link, show info for the file
/// the link references rather than for the link itself
opt Dereference("L", "dereference") => Bool
/// fill width with a comma separated list of entries
opt CommaSeparated("m") => Bool
/// like -l, but list numeric user and group IDs
opt NumericUidGid("n", "numeric-uid-gid") => Bool
/// print entry names without quoting
opt Literal("N", "literal") => Bool
/// like -l, but do not list group information
opt NoGroupInfo("o") => Bool
/// append / indicator to directories
opt IndicatorSlash("p") => Bool
/// print ? instead of nongraphic characters
opt HideControlChars("q", "hide-control-chars") => Bool
/// show nongraphic characters as-is
opt ShowControlChars("show-control-chars") => Bool
/// enclose entry names in double quotes
opt QuoteName("Q", "quote-name") => Bool
/// use quoting style WORD for entry names
opt QuotingStyle("quoting-style") => "literal" | "locale" | "shell" | "shell-always" | "shell-escape" | "shell-escape-always" | "c" | "escape"
/// reverse order while sorting
opt Reverse("r", "reverse") => Bool
/// list subdirectories recursively
opt Recursive("R", "recursive") => Bool
/// print the allocated size of each file, in blocks
opt Size("s", "size") => Bool
/// sort by file size, largest first
opt SortBySize("S") => Bool
/// sort by WORD instead of name: none, size, time, version, extension, width
opt Sort("sort") => "none" | "size" | "time" | "version" | "extension" | "width"
/// select which timestamp to display or sort by
opt Time("time") => "atime" | "access" | "use" | "ctime" | "status" | "mtime" | "modification" | "birth" | "creation"
/// time/date format with -l
opt TimeStyle("time-style") => String
/// sort by time, newest first
opt SortByTime("t") => Bool
/// assume tab stops at each COLS instead of 8
opt Tabsize("T", "tabsize") => UInt
/// with -lt: sort by, and show, access time; with -l: show access time
/// and sort by name; otherwise: sort by access time, newest first
opt AccessTime("u") => Bool
/// do not sort; list entries in directory order
opt NoSort("U") => Bool
/// natural sort of (version) numbers within text
opt VersionSort("v") => Bool
/// set output width to COLS; 0 means no limit
opt Width("w", "width") => UInt
/// list entries by lines instead of by columns
opt ListByLines("x") => Bool
/// sort alphabetically by entry extension
opt SortByExtension("X") => Bool
/// print any security context of each file
opt Context("Z", "context") => Bool
/// end each output line with NUL, not newline
opt Zero("zero") => Bool
/// list one file per line
opt OnePerLine("1") => Bool
/// display this help and exit
opt Help("help") => Bool [
excludes All
]
/// output version information and exit
opt Version("version") => Bool [
excludes All
]
}
cmd Main("mkdir") [
requires CreateDirectories
] {
/// directories to be created
arg CreateDirectories(..) => List<Path> [
requires DirNotExists
ensures DirExists
]
/// set file mode (as in chmod), not a=rwx - umask
opt Mode("m", "mode") => String
/// no error if existing, make parent directories as needed
opt Parents("p", "parents") => Bool
/// print a message for each created directory
opt Verbose("v", "verbose") => Bool
/// set the SELinux security context of each created directory to CTX
opt Context("Z", "context") => String
/// display this help and exit
opt Help("help") => Bool [
excludes All
]
/// output version information and exit
opt Version("version") => Bool [
excludes All
]
}
cmd Main("printf") [
requires Format
] {
/// the format string controlling output, as in C printf; may contain
/// literal characters, escape sequences (e.g. \n, \t, \uHHHH), and
/// format specifiers (e.g. %s, %d, %f); the format is reused as
/// necessary to consume all arguments
arg Format(0) => String
/// zero or more values substituted into FORMAT in order, according to
/// their corresponding format specifiers; if arguments exceed
/// specifiers, FORMAT is reused from the beginning; if fewer are
/// supplied, missing numeric specifiers default to 0 and string
/// specifiers to the empty string
arg Arguments(1..) => List<String>
/// assign the output to shell variable VAR rather than printing to
/// standard output (bash builtin only)
opt Var("v") => String
/// display help and exit
opt Help("help") => Bool [
excludes All
]
/// output version information and exit
opt Version("version") => Bool [
excludes All
]
}
cmd Main("rm") [
requires RemoveFiles
] {
/// files to be removed
arg RemoveFiles(..) => List<Path> [
requires FileExists
ensures FileNotExists
]
/// ignore nonexistent files and arguments, never prompt
opt Force("f", "force") => Bool [
relaxes FileExists
]
/// prompt before every removal
opt PromptEveryTime("i") => Bool
/// prompt once before removing more than three files, or when
/// removing recursively; less intrusive than -i, while still
/// giving protection against most mistakes
opt PromptOnce("I") => Bool
/// prompt according to WHEN: never, once (-I), or always (-i);
/// without WHEN, prompt always
opt Interactive("interactive") => "never" | "no" | "none" | "once" | "always" | "yes" [
@default("never")
]
/// when removing a hierarchy recursively, skip any directory
/// that is on a file system different from that of the
/// corresponding command line argument
opt OneFs("one-file-system") => Bool
/// do not remove '/' (default); with 'all', reject any command
/// line argument on a separate device from its parent
opt NoPreserveRoot("preserve-root") => String [
@default("all")
]
/// remove directories and their contents recursively
opt Recursive("r", "R", "recursive") => Bool
/// remove empty directories
opt Dir("d", "dir") => Bool
/// explain what is being done
opt Verbose("v", "verbose") => Bool
/// show help menu
opt Help("help") => Bool [
excludes All
]
/// output version information and exit
opt Version("version") => Bool [
excludes All
]
}
cmd Main("touch") [
requires Files
] {
/// files whose timestamps should be updated, or created if they do not exist
arg Files(..) => List<Path> [
ensures FileExists
]
/// change only the access time; if absent, both access and modification
/// times are updated
opt AccessOnly("a") => Bool [
excludes ModifyOnly
]
/// do not create any files; silently ignore each argument that does not
/// already exist
opt NoCreate("c", "no-create") => Bool
/// parse STRING as a date/time description and use it instead of the
/// current time (e.g. "2 hours ago", "next Monday", "2024-06-01 12:00")
opt Date("d", "date") => String [
excludes Reference & Stamp
]
/// affect each symbolic link itself rather than the file the link
/// refers to; only on systems that support lchown(2)
opt NoDereference("h", "no-dereference") => Bool
/// change only the modification time
opt ModifyOnly("m") => Bool [
excludes AccessOnly
]
/// use the timestamps of FILE instead of the current time; FILE must
/// already exist
opt Reference("r", "reference") => Path [
requires FileExists
excludes Date & Stamp
]
/// use the time STAMP instead of the current time, where STAMP is
/// formatted as [[CC]YY]MMDDhhmm[.ss]
/// TODO add a refinement type: @pattern("^(\\d{2})?(\\d{2})?\\d{4}\\d{4}(\\.\\d{2})?$")
opt Stamp("t") => String [
excludes Date & Reference
]
/// explicitly select which timestamp to update: "access", "atime", and
/// "use" are equivalent to -a; "modify" and "mtime" are equivalent to -m
opt Time("time") => "access" | "atime" | "use" | "modify" | "mtime"
/// display help and exit
opt Help("help") => Bool [
excludes All
]
/// output version information and exit
opt Version("version") => Bool [
excludes All
]
}