id
stringlengths
36
36
input
stringlengths
14
114
output
stringlengths
55
951
category
stringclasses
5 values
source_repo
stringclasses
7 values
source_commit
stringclasses
7 values
source_file
stringlengths
10
40
source_line
int32
1
4.38k
tokens_input
int32
4
29
tokens_output
int32
14
238
quality_score
float32
0.7
1
41bbe76d-1c70-536f-8718-52913e111cde
fn parse_low() -> ParseResult < LowArgs > {}
/// Parse CLI arguments only into their low level representation. /// /// This takes configuration into account. That is, it will try to read /// `RIPGREP_CONFIG_PATH` and prepend any arguments found there to the /// arguments passed to this process. /// /// This will also set one-time global state flags, such as the log level and /// whether messages should be printed.
function
BurntSushi/ripgrep
0a88ccc
crates/core/flags/parse.rs
64
11
93
0.9
18abdbc7-9924-59bf-b39a-4e53024150aa
struct Error {}
/// An error that can occur in this crate. /// /// Generally, this error corresponds to problems building a regular /// expression, whether it's in parsing, compilation or a problem with /// guaranteeing a configured optimization.
function
BurntSushi/ripgrep
0a88ccc
crates/pcre2/src/error.rs
7
4
58
0.9
d98c7581-c9fd-5b61-ab44-88bee9c651fc
fn iterate_over<I, T>(self, inner: I) -> Iter < I > {}
/// Creates an iterator that, as well as yielding each value, yields a /// `TreeParams` with the current depth and last flag filled in.
argument
eza-community/eza
58b98cf
src/output/tree.rs
165
14
34
0.8
cdfcbd23-d313-5b21-b75d-74e8c4f2bad1
fn short_flag(self, short: impl IntoResettable < char >) -> Self {}
/// Sets the short version of the subcommand flag without the preceding `-`. /// /// Allows the subcommand to be used as if it were an [`Arg::short`]. /// /// # Examples /// /// ``` /// # use clap_builder as clap; /// # use clap::{Command, Arg, ArgAction}; /// let matches = Command::new("pacman") /// .subcommand( /// Command::new("sync").short_flag('S').arg( /// Arg::new("search") /// .short('s') /// .long("search") /// .action(ArgAction::SetTrue) /// .help("search remote repositories for matching strings"), /// ), /// ) /// .get_matches_from(vec!["pacman", "-Ss"]); /// /// assert_eq!(matches.subcommand_name().unwrap(), "sync"); /// let sync_matches = matches.subcommand_matches("sync").unwrap(); /// assert!(sync_matches.get_flag("search")); /// ``` /// [`Arg::short`]: Arg::short()
example
clap-rs/clap
b8be10b
clap_builder/src/builder/command.rs
2,605
17
224
1
7da24a14-943e-54af-878f-9a1816efebea
fn compare_files(self, a: & File < '_ >, b: & File < '_ >) -> Ordering {}
/// Compares two files to determine the order they should be listed in, /// depending on the search field. /// /// The `natord` crate is used here to provide a more *natural* sorting /// order than just sorting character-by-character. This splits filenames /// into groups between letters and numbers, and then sorts those blocks /// together, so `file10` will sort after `file9`, instead of before it /// because of the `1`.
argument
eza-community/eza
58b98cf
src/fs/filter.rs
264
19
107
0.9
0eb01759-cfe6-5f9d-b096-877efd78d162
fn parse<P>(path: P) -> anyhow :: Result < (Vec < OsString > , Vec < anyhow :: Error >) > {}
/// Parse a single ripgrep rc file from the given path. /// /// On success, this returns a set of shell arguments, in order, that should /// be pre-pended to the arguments given to ripgrep at the command line. /// /// If the file could not be read, then an error is returned. If there was /// a problem parsing one or more lines in the file, then errors are returned /// for each line in addition to successfully parsed arguments.
function
BurntSushi/ripgrep
0a88ccc
crates/core/flags/config.rs
57
23
108
0.9
30c58ecd-1633-505d-91e3-abbc795c82ae
enum ThemePreference {}
/// What theme should `bat` use? /// /// The easiest way to construct this is from a string: /// ``` /// # use bat::theme::{ThemePreference, DetectColorScheme}; /// let preference = ThemePreference::new("auto:system"); /// assert_eq!(ThemePreference::Auto(DetectColorScheme::System), preference); /// ```
example
sharkdp/bat
cd06fe4
src/theme.rs
67
6
76
1
9b65488f-d853-5224-884a-c766debb822c
fn deduce(matches: & MatchedFlags < '_ >) -> Result < Self , OptionsError > {}
/// Determines the dot filter based on how many `--all` options were /// given: one will show dotfiles, but two will show `.` and `..` too. /// --almost-all is equivalent to --all, included for compatibility with /// `ls -A`. /// /// It also checks for the `--tree` option, because of a special case /// where `--tree --all --all` won’t work: listing the parent directory /// in tree mode would loop onto itself! /// /// `--almost-all` binds stronger than multiple `--all` as we currently do not take the order /// of arguments into account and it is the safer option (does not clash with `--tree`)
argument
eza-community/eza
58b98cf
src/options/filter.rs
150
20
150
0.9
b9d50329-d433-570f-b19c-7e7ed751b9ec
fn str_to_bool(val: impl AsRef < str >) -> Option < bool > {}
/// Converts a string literal representation of truth to true or false. /// /// `false` values are `n`, `no`, `f`, `false`, `off`, and `0` (case insensitive). /// /// Any other value will be considered as `true`.
function
clap-rs/clap
b8be10b
clap_builder/src/util/str_to_bool.rs
12
16
53
0.9
8c8e0413-b608-5290-89b5-025f6d6a78c2
fn module<'a>(context: & 'a Context) -> Option < Module < 'a > > {}
/// Creates a module with the Git branch in the current directory /// /// Will display the branch name if the current directory is a git repo /// By default, the following symbols will be used to represent the repo's status: /// - `=` – This branch has merge conflicts /// - `⇡` – This branch is ahead of the branch being tracked /// - `⇣` – This branch is behind of the branch being tracked /// - `⇕` – This branch has diverged from the branch being tracked /// - `` – This branch is up-to-date with the branch being tracked /// - `?` — There are untracked files in the working directory /// - `$` — A stash exists for the local repository /// - `!` — There are file modifications in the working directory /// - `+` — A new file has been added to the staging area /// - `»` — A renamed file has been added to the staging area /// - `✘` — A file's deletion has been added to the staging area
argument
starship/starship
61eee25
src/modules/git_status.rs
31
17
236
0.9
6154a855-0750-548b-b637-43411ce683f9
fn deduce(matches: & MatchedFlags < '_ >) -> Result < Self , OptionsError > {}
/// Determine which file size to use in the file size column based on /// the user’s options. /// /// The default mode is to use the decimal prefixes, as they are the /// most commonly-understood, and don’t involve trying to parse large /// strings of digits in your head. Changing the format to anything else /// involves the `--binary` or `--bytes` flags, and these conflict with /// each other.
argument
eza-community/eza
58b98cf
src/options/view.rs
325
20
101
0.9
5ec52fa4-cf12-577b-b67e-b808e00abf9c
fn group(self, group_id: impl IntoResettable < Id >) -> Self {}
/// The name of the [`ArgGroup`] the argument belongs to. /// /// # Examples /// /// ```rust /// # use clap_builder as clap; /// # use clap::{Command, Arg, ArgAction}; /// Arg::new("debug") /// .long("debug") /// .action(ArgAction::SetTrue) /// .group("mode") /// # ; /// ``` /// /// Multiple arguments can be a member of a single group and then the group checked as if it /// was one of said arguments. /// /// ```rust /// # use clap_builder as clap; /// # use clap::{Command, Arg, ArgAction}; /// let m = Command::new("prog") /// .arg(Arg::new("debug") /// .long("debug") /// .action(ArgAction::SetTrue) /// .group("mode")) /// .arg(Arg::new("verbose") /// .long("verbose") /// .action(ArgAction::SetTrue) /// .group("mode")) /// .get_matches_from(vec![ /// "prog", "--debug" /// ]); /// assert!(m.contains_id("mode")); /// ``` /// /// [`ArgGroup`]: crate::ArgGroup
example
clap-rs/clap
b8be10b
clap_builder/src/builder/arg.rs
2,883
16
238
1
c9950e7d-64fc-50b0-8df8-5ce67f23dcbf
fn format_short_columns(col1: & [String], col2: & [String], maxcol1: usize, _maxcol2: usize) -> String {}
/// Write two columns of documentation. /// /// `maxcol1` should be the maximum length (in bytes) of the first column, /// while `maxcol2` should be the maximum length (in bytes) of the second /// column.
function
BurntSushi/ripgrep
0a88ccc
crates/core/flags/doc/help.rs
87
27
51
0.9
baeb34c2-a26a-51af-886c-ece547a5c659
fn remove_roff(v: & str) -> String {}
/// Removes roff syntax from `v` such that the result is approximately plain /// text readable. /// /// This is basically a mish mash of heuristics based on the specific roff used /// in the docs for the flags in this tool. If new kinds of roff are used in /// the docs, then this may need to be updated to handle them.
function
BurntSushi/ripgrep
0a88ccc
crates/core/flags/doc/help.rs
216
10
80
0.9
1053364f-bcc1-5b07-9f2d-66d9fae61665
fn deduce(matches: & MatchedFlags < '_ >, tree: bool) -> Result < Self , OptionsError > {}
/// Determine which files should be recursed into, based on the `--level` /// flag’s value, and whether the `--tree` flag was passed, which was /// determined earlier. The maximum level should be a number, and this /// will fail with an `Err` if it isn’t.
argument
eza-community/eza
58b98cf
src/options/dir_action.rs
65
23
65
0.9
fe52e8fe-fb4c-5810-8dd5-9d6b1cbf7193
fn ngrams(flag_name: & str) -> BagOfWords < '_ > {}
/// Returns all 3-grams in the slice given. /// /// If the slice doesn't contain a 3-gram, then one is artificially created by /// padding it out with a character that will never appear in a flag name.
function
BurntSushi/ripgrep
0a88ccc
crates/core/flags/parse.rs
466
13
51
0.9
2d90b6f6-480b-539a-8e6d-500f90797939
fn get(&self) -> (usize , usize) {}
/// Returns the specific number of contextual lines that should be shown /// around each match. This takes proper precedent into account, i.e., /// that `before` and `after` both partially override `both` in all cases. /// /// By default, this returns `(0, 0)`.
function
BurntSushi/ripgrep
0a88ccc
crates/core/flags/lowargs.rs
452
9
66
0.9
839ef27f-4c84-57dc-83c1-e5b09bfa451a
fn from_string(input: & str) -> Result < Self > {}
/// Parses an owner constraint /// Returns an error if the string is invalid /// Returns Ok(None) when string is acceptable but a noop (such as "" or ":")
error
sharkdp/fd
bf81fb9
src/filter/owner.rs
27
13
39
0.8
aafdd6c4-5d68-57dd-8cc2-9ddbcd5b2b49
fn contract_repo_path(full_path: & Path, top_level_path: & Path) -> Option < String > {}
/// Contract the root component of a path based on the real path /// /// Replaces the `top_level_path` in a given `full_path` with the provided /// `top_level_replacement` by walking ancestors and comparing its real path.
argument
starship/starship
61eee25
src/modules/directory.rs
241
22
56
0.9
bf8d0469-107a-571c-b70a-96a1a8e0ef2f
fn trim_line_terminator<'b>(searcher: & Searcher, buf: & 'b [u8], line: & mut Match) -> & 'b [u8] {}
/// Given a buf and some bounds, if there is a line terminator at the end of /// the given bounds in buf, then the bounds are trimmed to remove the line /// terminator, returning the slice of the removed line terminator (if any).
function
BurntSushi/ripgrep
0a88ccc
crates/printer/src/util.rs
535
25
58
0.9
2f173122-971a-541d-b0b9-e7f5cd404579
fn requires_path(&self) -> bool {}
/// Returns true if and only if this output mode requires a file path. /// /// When an output mode requires a file path, then the summary printer /// will report an error at the start of every search that lacks a file /// path.
function
BurntSushi/ripgrep
0a88ccc
crates/printer/src/summary.rs
103
9
57
0.9
e4638518-b85f-5c72-bc1f-f5f518412730
fn strip_jemalloc_nonsense(data: & [u8]) -> Vec < u8 > {}
/// Strips absolutely fucked `<jemalloc>:` lines from the output. /// /// In theory this only happens under qemu, which is where our tests run under /// `cross`. But is messes with our tests, because... they don't expect the /// allocator to fucking write to stderr. I mean, what the fuck? Who prints a /// warning message with absolutely no instruction for what to do with it or /// how to disable it. Absolutely fucking bonkers.
function
BurntSushi/ripgrep
0a88ccc
tests/util.rs
509
15
108
0.9
43ce73de-f7f8-57aa-a641-5b22264b8464
struct HyperlinkEnvironment {}
/// A static environment for hyperlink interpolation. /// /// This environment permits setting the values of variables used in hyperlink /// interpolation that are not expected to change for the lifetime of a program. /// That is, these values are invariant. /// /// Currently, this includes the hostname and a WSL distro prefix.
function
BurntSushi/ripgrep
0a88ccc
crates/printer/src/hyperlink/mod.rs
251
8
83
0.9
489abd5d-e391-524a-afa2-bcc87138c5d2
mod ripgrep {}
//! Used to simulate a fairly large number of options/flags and parsing with thousands of positional //! args //! //! CLI used is adapted from ripgrep 48a8a3a691220f9e5b2b08f4051abe8655ea7e8a
module
clap-rs/clap
b8be10b
clap_bench/benches/ripgrep.rs
1
4
48
0.75
d8e33e50-348a-525b-9318-87791821e756
fn module<'a>(name: Option < & str >, context: & 'a Context) -> Option < Module < 'a > > {}
/// Creates a module with the value of the chosen environment variable /// /// Will display the environment variable's value if all of the following criteria are met: /// - `env_var.disabled` is absent or false /// - `env_var.variable` is defined /// - a variable named as the value of `env_var.variable` is defined
argument
starship/starship
61eee25
src/modules/env_var.rs
14
23
82
0.9
de1e3385-4bd6-50db-925e-6770875efa40
enum PatternSource {}
/// Represents a source of patterns that ripgrep should search for. /// /// The reason to unify these is so that we can retain the order of `-f/--flag` /// and `-e/--regexp` flags relative to one another.
function
BurntSushi/ripgrep
0a88ccc
crates/core/flags/lowargs.rs
645
6
51
0.9
f33fd8fe-3877-5c6a-b8d6-56b214737bf9
fn override_config(&mut self, mutconfig: Config) -> Config {}
/// Overrides the shared options (See `tokei::Config` for option /// descriptions) between the CLI and the config files. CLI flags have /// higher precedence than options present in config files. /// /// #### Shared options /// * `hidden` /// * `no_ignore` /// * `no_ignore_parent` /// * `no_ignore_dot` /// * `no_ignore_vcs` /// * `types`
argument
XAMPPRocky/tokei
6c71dd7
src/cli.rs
399
16
85
0.9
f394aba6-c057-544f-87ca-ad33ce347350
fn new_no_color(wtr: W) -> Standard < NoColor < W > > {}
/// Return a standard printer with a default configuration that writes /// matches to the given writer. /// /// The writer can be any implementation of `io::Write`. With this /// constructor, the printer will never emit colors.
function
BurntSushi/ripgrep
0a88ccc
crates/printer/src/standard.rs
505
14
57
0.9
0c737ee2-5a9a-57fe-b73c-84c5bcd4612c
mod doc_comments {}
//! The preprocessing we apply to doc comments. //! //! #[derive(Parser)] works in terms of "paragraphs". Paragraph is a sequence of //! non-empty adjacent lines, delimited by sequences of blank (whitespace only) lines.
module
clap-rs/clap
b8be10b
clap_derive/src/utils/doc_comments.rs
1
5
55
0.85
6aeb3fec-6a8d-5f67-bf6f-1be3ff156ee0
struct InterpolatorStatus {}
/// A status indicating whether a hyperlink was written or not. /// /// This is created by `Interpolator::begin` and used by `Interpolator::finish` /// to determine whether a hyperlink was actually opened or not. If it wasn't /// opened, then finishing interpolation is a no-op.
function
BurntSushi/ripgrep
0a88ccc
crates/printer/src/hyperlink/mod.rs
693
7
70
0.9
80bc489f-921f-5512-921e-07c422e85843
fn name(self, name: impl Into < Str >) -> Self {}
/// (Re)Sets the program's name. /// /// See [`Command::new`] for more details. /// /// # Examples /// /// ```ignore /// let cmd = clap::command!() /// .name("foo"); /// /// // continued logic goes here, such as `cmd.get_matches()` etc. /// ```
example
clap-rs/clap
b8be10b
clap_builder/src/builder/command.rs
1,863
13
62
1
f8b7774d-8eee-5caf-a9f7-0756a41e853a
fn unwrap_switch(self) -> bool {}
/// Return the yes or no value of this switch. /// /// If this flag value is not a switch, then this panics. /// /// This is useful when writing the implementation of `Flag::update`. /// namely, callers usually know whether a switch or a value is expected. /// If a flag is something different, then it indicates a bug, and thus a /// panic is acceptable.
function
BurntSushi/ripgrep
0a88ccc
crates/core/flags/mod.rs
277
9
89
0.9
a21f35e4-878e-5896-8e4b-d0b06b551678
fn parser(input: TokenStream) -> TokenStream {}
/// Generates the `Parser` implementation. /// /// This is far less verbose than defining the `clap::Command` struct manually, /// receiving an instance of `clap::ArgMatches` from conducting parsing, and then /// implementing a conversion code to instantiate an instance of the user /// context struct.
argument
clap-rs/clap
b8be10b
clap_derive/src/lib.rs
55
12
76
0.9
976d78f6-519e-55cd-a865-689462ff8f16
fn scan(paths: & [PathBuf], patterns: Vec < Regex >, config: Config) -> Result < ExitCode > {}
/// Recursively scan the given search path for files / pathnames matching the patterns. /// /// If the `--exec` argument was supplied, this will create a thread pool for executing /// jobs in parallel from a given command line and the discovered paths. Otherwise, each /// path will simply be written to standard output.
argument
sharkdp/fd
bf81fb9
src/walk.rs
678
24
80
0.9
ebf3eda9-0de5-5238-975e-5bee99afb6c2
fn deduce(matches: & MatchedFlags < '_ >) -> Result < Self , OptionsError > {}
/// Determine which of a file’s time fields should be displayed for it /// based on the user’s options. /// /// There are two separate ways to pick which fields to show: with a /// flag (such as `--modified`) or with a parameter (such as /// `--time=modified`). An error is signaled if both ways are used. /// /// It’s valid to show more than one column by passing in more than one /// option, but passing *no* options means that the user just wants to /// see the default set.
argument
eza-community/eza
58b98cf
src/options/view.rs
417
20
121
0.9
9254b3bf-2e8a-53d9-b586-39789b18f2af
fn suggest(unrecognized: & str) -> Option < String > {}
/// Possibly return a message suggesting flags similar in the name to the one /// given. /// /// The one given should be a flag given by the user (without the leading /// dashes) that was unrecognized. This attempts to find existing flags that /// are similar to the one given.
function
BurntSushi/ripgrep
0a88ccc
crates/core/flags/parse.rs
404
14
70
0.9
02e0ec14-15b0-514f-9dd0-a538ca06ef60
mod escaped_positional {}
//! # Example (Builder API) //! //! ```rust //! ``` //!
module
clap-rs/clap
b8be10b
src/_cookbook/escaped_positional.rs
1
7
14
0.75
1089db70-723e-5d45-8dd7-24309127be3d
fn render_custom_markup(mutdoc: & str, tag: & str, mutreplacement: impl FnMut (& str , & mut String)) -> String {}
/// Searches for `\tag{...}` occurrences in `doc` and calls `replacement` for /// each such tag found. /// /// The first argument given to `replacement` is the tag value, `...`. The /// second argument is the buffer that accumulates the full replacement text. /// /// Since this function is only intended to be used on doc strings written into /// the program source code, callers should panic in `replacement` if there are /// any errors or unexpected circumstances.
function
BurntSushi/ripgrep
0a88ccc
crates/core/flags/doc/mod.rs
18
29
117
0.9
c5156053-1d0d-53c9-9bfd-daf6bdb24bf9
fn apply_overlay(mutbase: Style, overlay: Style) -> Style {}
/// Some of the styles are **overlays**: although they have the same attribute /// set as regular styles (foreground and background colours, bold, underline, /// etc), they’re intended to be used to *amend* existing styles. /// /// For example, the target path of a broken symlink is displayed in a red, /// underlined style by default. Paths can contain control characters, so /// these control characters need to be underlined too, otherwise it looks /// weird. So instead of having four separate configurable styles for “link /// path”, “broken link path”, “control character” and “broken control /// character”, there are styles for “link path”, “control character”, and /// “broken link overlay”, the latter of which is just set to override the /// underline attribute on the other two.
example
eza-community/eza
58b98cf
src/theme/mod.rs
523
15
206
0.9
99ba9911-3f14-5ad1-8f55-ab7626364532
const fn is_none(&self) -> bool {}
/// Returns `true` if `None` /// /// # Examples /// /// ``` /// use eza::fs::recursive_size::RecursiveSize; /// /// let x = RecursiveSize::None; /// assert_eq!(x.is_none(), true); /// /// let x = RecursiveSize::Unknown; /// assert_eq!(x.is_none(), false); /// /// let x = RecursiveSize::Some(0, 0); /// assert_eq!(x.is_none(), false); /// ```
example
eza-community/eza
58b98cf
src/fs/recursive_size.rs
41
9
86
1
d8563d29-2aa7-5317-845e-0e3968df6a38
struct DecimalFormatter {}
/// A simple formatter for converting `u64` values to ASCII byte strings. /// /// This avoids going through the formatting machinery which seems to /// substantially slow things down. /// /// The `itoa` crate does the same thing as this formatter, but is a bit /// faster. We roll our own which is a bit slower, but gets us enough of a win /// to be satisfied with and with pure safe code.
function
BurntSushi/ripgrep
0a88ccc
crates/printer/src/util.rs
415
7
98
0.9
15d4dce3-887e-54ae-b4d4-7f9fff07e887
struct ColorSpecs {}
/// A merged set of color specifications. /// /// This set of color specifications represents the various color types that /// are supported by the printers in this crate. A set of color specifications /// can be created from a sequence of /// [`UserColorSpec`]s.
function
BurntSushi/ripgrep
0a88ccc
crates/printer/src/color.rs
88
5
66
0.9
88d87ff6-dffc-57de-b02e-ba08f716285c
enum SubMatches {}
/// SubMatches represents a set of matches in a contiguous range of bytes. /// /// A simpler representation for this would just simply be `Vec<SubMatch>`, /// but the common case is exactly one match per range of bytes, which we /// specialize here using a fixed size array without any allocation.
function
BurntSushi/ripgrep
0a88ccc
crates/printer/src/json.rs
847
5
75
0.9
930fca18-77aa-5c58-8dfc-348f20265e72
fn has_uppercase_literal(pattern: & str) -> bool {}
/// Determine whether the pattern contains an uppercase character which should /// negate the effect of the smart-case option. /// /// Ideally we would be able to check the AST in order to correctly handle /// things like '\p{Ll}' and '\p{Lu}' (which should be treated as explicitly /// cased), but PCRE doesn't expose enough details for that kind of analysis. /// For now, our 'good enough' solution is to simply perform a semi-naïve /// scan of the input pattern and ignore all characters following a '\'. The /// This at least lets us support the most common cases, like 'foo\w' and /// 'foo\S', in an intuitive manner.
function
BurntSushi/ripgrep
0a88ccc
crates/pcre2/src/matcher.rs
422
13
156
0.9
1fb8e1b4-a56b-5e79-9555-2ce7df4f872f
struct KindFormatter {}
/// Report [`ErrorKind`] /// /// No context is included. /// /// <div class="warning"> /// /// **NOTE:** Consider removing the `error-context` default feature if using this to remove all /// overhead for [`RichFormatter`]. /// /// </div>
function
clap-rs/clap
b8be10b
clap_builder/src/error/format.rs
36
6
60
0.9
43891b2a-d898-5263-a525-8c7f2c4eed21
fn search(&self, index: & Path, prefix_lookup: bool) -> f :: Git {}
/// Searches through this repository for a path (to a file or directory, /// depending on the prefix-lookup flag) and returns its Git status. /// /// Actually querying the `git2` repository for the mapping of paths to /// Git statuses is only done once, and gets cached so we don’t need to /// re-query the entire repository the times after that. /// /// The temporary `Processing` enum variant is used after the `git2` /// repository is moved out, but before the results have been moved in! /// See <https://stackoverflow.com/q/45985827/3484614>
argument
eza-community/eza
58b98cf
src/fs/feature/git.rs
152
17
137
0.9
7f001ec9-b388-577f-bb95-7895c2a1a37e
fn raw(kind: ErrorKind, message: impl Display) -> Self {}
/// Create an unformatted error /// /// This is for you need to pass the error up to /// a place that has access to the `Command` at which point you can call [`Error::format`]. /// /// Prefer [`Command::error`] for generating errors. /// /// [`Command::error`]: crate::Command::error
argument
clap-rs/clap
b8be10b
clap_builder/src/error/mod.rs
88
15
71
0.9
14074246-f9a9-5d69-81e8-f49ab8f85389
fn find_subcommand_with_path<'cmd>(p: & 'cmd Command, path: Vec < & str >) -> & 'cmd Command {}
/// Finds the subcommand [`clap::Command`] from the given [`clap::Command`] with the given path. /// /// <div class="warning"> /// /// **NOTE:** `path` should not contain the root `bin_name`. /// /// </div>
argument
clap-rs/clap
b8be10b
clap_complete/src/aot/generator/utils.rs
26
24
52
0.9
a84694d7-11fa-571f-b25b-9863d1eafcb6
fn no_binary_name(self, yes: bool) -> Self {}
/// Specifies that the parser should not assume the first argument passed is the binary name. /// /// This is normally the case when using a "daemon" style mode. For shells / REPLs, see /// [`Command::multicall`][Command::multicall]. /// /// # Examples /// /// ```rust /// # use clap_builder as clap; /// # use clap::{Command, arg}; /// let m = Command::new("myprog") /// .no_binary_name(true) /// .arg(arg!(<cmd> ... "commands to run")) /// .get_matches_from(vec!["command", "set"]); /// /// let cmds: Vec<_> = m.get_many::<String>("cmd").unwrap().collect(); /// assert_eq!(cmds, ["command", "set"]); /// ``` /// [`try_get_matches_from_mut`]: crate::Command::try_get_matches_from_mut()
example
clap-rs/clap
b8be10b
clap_builder/src/builder/command.rs
1,186
12
175
1
7e0f2608-008d-5b0f-9a62-516f94f9f7a9
struct NiceDuration {}
/// A type that provides "nicer" Display and Serialize impls for /// std::time::Duration. The serialization format should actually be compatible /// with the Deserialize impl for std::time::Duration, since this type only /// adds new fields.
function
BurntSushi/ripgrep
0a88ccc
crates/printer/src/util.rs
372
6
61
0.9
74de9077-ffe6-5a04-86b2-9a199b917b08
fn test_number_parsing_errors() {}
/// Make sure that fd fails if numeric arguments can not be parsed
error
sharkdp/fd
bf81fb9
tests/tests.rs
2,538
9
17
0.7
97772e91-7c22-5431-8181-263bea1d2c9d
fn as_str(&self) -> & 'static str {}
/// Returns a string representation of this category. /// /// This string is the name of the variable used in various templates for /// generated documentation. This name can be used for interpolation.
function
BurntSushi/ripgrep
0a88ccc
crates/core/flags/mod.rs
222
9
51
0.9
31075dd7-4b17-5d8a-ac0b-4fd462448abf
enum ThemeName {}
/// The name of a theme or the default theme. /// /// ``` /// # use bat::theme::ThemeName; /// assert_eq!(ThemeName::Default, ThemeName::new("default")); /// assert_eq!(ThemeName::Named("example".to_string()), ThemeName::new("example")); /// ```
example
sharkdp/bat
cd06fe4
src/theme.rs
131
5
62
1
0b5fe4ec-8ade-57b2-916e-d51896665eba
fn parse_reader<R>(rdr: R) -> anyhow :: Result < (Vec < OsString > , Vec < anyhow :: Error >) > {}
/// Parse a single ripgrep rc file from the given reader. /// /// Callers should not provided a buffered reader, as this routine will use its /// own buffer internally. /// /// On success, this returns a set of shell arguments, in order, that should /// be pre-pended to the arguments given to ripgrep at the command line. /// /// If the reader could not be read, then an error is returned. If there was a /// problem parsing one or more lines, then errors are returned for each line /// in addition to successfully parsed arguments.
function
BurntSushi/ripgrep
0a88ccc
crates/core/flags/config.rs
78
25
134
0.9
b7c1ecc7-dd13-5cc2-bdd4-7f68ec44b364
fn build(&mut self) {}
/// Prepare for introspecting on all included [`Command`]s /// /// Call this on the top-level [`Command`] when done building and before reading state for /// cases like completions, custom help output, etc.
function
clap-rs/clap
b8be10b
clap_builder/src/builder/command.rs
4,379
6
52
0.9
608faffe-d8ad-5550-8256-11a3f5700244
struct Config {}
/// The configuration for the JSON printer. /// /// This is manipulated by the JSONBuilder and then referenced by the actual /// implementation. Once a printer is build, the configuration is frozen and /// cannot changed.
function
BurntSushi/ripgrep
0a88ccc
crates/printer/src/json.rs
25
4
56
0.9
42bea20b-ab31-55ba-8cc6-7712eeba8a09
fn process_author_str(author: & str) -> String {}
/// replace all `:` with `, ` when not inside the `<>` /// /// `"author1:author2:author3" => "author1, author2, author3"` /// `"author1 <http://website1.com>:author2" => "author1 <http://website1.com>, author2"`
argument
clap-rs/clap
b8be10b
clap_derive/src/item.rs
1,355
13
53
0.9
0c419369-9b09-5018-b2b6-6581e3431920
fn new(path: PathBuf) -> Self {}
/// Create a new, empty `Dir` object representing the directory at the given path. /// /// This function does not attempt to read the contents of the directory; it merely /// initializes an instance of `Dir` with an empty `DirEntry` list and the specified path. /// To populate the `Dir` object with actual directory contents, use the `read` function.
argument
eza-community/eza
58b98cf
src/fs/dir.rs
39
8
88
0.9
4c95e31a-fdfb-5aea-88a8-4e3b2fe10c87
fn default_color_specs() -> Vec < UserColorSpec > {}
/// Returns a default set of color specifications. /// /// This may change over time, but the color choices are meant to be fairly /// conservative that work across terminal themes. /// /// Additional color specifications can be added to the list returned. More /// recently added specifications override previously added specifications.
function
BurntSushi/ripgrep
0a88ccc
crates/printer/src/color.rs
10
13
85
0.9
9a61bca5-52aa-5ab4-8b71-65addeb6c25e
fn job(results: impl IntoIterator < Item = WorkerResult >, cmd: & CommandSet, config: & Config) -> ExitCode {}
/// An event loop that listens for inputs from the `rx` receiver. Each received input will /// generate a command with the supplied command template. The generated command will then /// be executed, and this process will continue until the receiver's sender has closed.
argument
sharkdp/fd
bf81fb9
src/exec/job.rs
11
28
68
0.9
8d936d8a-2fca-57e4-839c-43402a3e0624
fn to_color_spec(&self) -> ColorSpec {}
/// Convert this user provided color specification to a specification that /// can be used with `termcolor`. This drops the type of this specification /// (where the type indicates where the color is applied in the standard /// printer, e.g., to the file path or the line numbers, etc.).
function
BurntSushi/ripgrep
0a88ccc
crates/printer/src/color.rs
162
10
72
0.9
882ae145-b890-56db-a7a7-40c68daec926
fn new(id: impl Into < Id >) -> Self {}
/// Create a `ArgGroup` using a unique name. /// /// The name will be used to get values from the group or refer to the group inside of conflict /// and requirement rules. /// /// # Examples /// /// ```rust /// # use clap_builder as clap; /// # use clap::{Command, ArgGroup}; /// ArgGroup::new("config") /// # ; /// ```
example
clap-rs/clap
b8be10b
clap_builder/src/builder/arg_group.rs
92
10
80
1
cb6a555e-ee7f-5e56-9b71-62e45dfa26ff
fn new(name: impl Into < Str >) -> Self {}
/// Creates a new instance of an `Command`. /// /// It is common, but not required, to use binary name as the `name`. This /// name will only be displayed to the user when they request to print /// version or help and usage information. /// /// See also [`command!`](crate::command!) and [`crate_name!`](crate::crate_name!). /// /// # Examples /// /// ```rust /// # use clap_builder as clap; /// # use clap::Command; /// Command::new("My Program") /// # ; /// ```
example
clap-rs/clap
b8be10b
clap_builder/src/builder/command.rs
133
11
116
1
9f6a7eb9-9ec6-518d-b2e7-91842e3cae8d
fn repo_to_statuses(repo: & git2 :: Repository, workdir: & Path) -> Git {}
/// Iterates through a repository’s statuses, consuming it and returning the /// mapping of files to their Git status. /// We will have already used the working directory at this point, so it gets /// passed in rather than deriving it from the `Repository` again.
argument
eza-community/eza
58b98cf
src/fs/feature/git.rs
227
19
67
0.9