kolokd
April 17, 2020, 6:56pm
#1
i like know about the rust repo, how it is organized especially the cli interface
Start here:
&& (config.opts.debugging_opts.time_passes || config.opts.debugging_opts.time);
}
}
pub fn diagnostics_registry() -> Registry {
Registry::new(&rustc_error_codes::DIAGNOSTICS)
}
// Parse args and run the compiler. This is the primary entry point for rustc.
// The FileLoader provides a way to load files from sources other than the file system.
pub fn run_compiler(
at_args: &[String],
callbacks: &mut (dyn Callbacks + Send),
file_loader: Option<Box<dyn FileLoader + Send + Sync>>,
emitter: Option<Box<dyn Write + Send>>,
) -> interface::Result<()> {
let mut args = Vec::new();
for arg in at_args {
match args::arg_expand(arg.clone()) {
Ok(arg) => args.extend(arg),
Err(err) => early_error(
Clap is particularly powerful, and also has a macro option. You can define subcommands with it like a true champ.
https://crates.io/crates/clap
This, however, doesn't answer the OP, since rustc
itself uses not clap, but getopts .
Getops is not as pretty as clap, but perhaps I misunderstood the question. I assumed the question was about what crate can handle command line arguments.
system
closed
July 17, 2020, 9:17am
#6
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.