forked from Kampfkarren/selene
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
de0380a
commit fce8dae
Showing
3 changed files
with
46 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,13 +6,13 @@ authors = ["Kampfkarren <[email protected]>"] | |
edition = "2018" | ||
|
||
[dependencies] | ||
clap = "2" | ||
codespan = "0.4" | ||
codespan-reporting = "0.4" | ||
full_moon = "0.4.0-rc.11" | ||
glob = "0.3" | ||
selene-lib = { path = "../selene-lib" } | ||
num_cpus = "1.10" | ||
structopt = "0.3" | ||
termcolor = "1.0" | ||
threadpool = "1.7" | ||
toml = "0.5" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
use std::ffi::OsString; | ||
|
||
use structopt::StructOpt; | ||
|
||
#[derive(StructOpt)] | ||
#[structopt(rename_all = "kebab-case")] | ||
pub struct Options { | ||
/// A glob to match files with to check | ||
#[structopt(long, default_value = "**/*.lua")] | ||
pub pattern: String, | ||
|
||
/// A toml file to configure the behavior of selene [default: selene.toml] | ||
// .default is not used here since if the user explicitly specifies the config file | ||
// we want it to error if it doesn't exist | ||
#[structopt(long)] | ||
pub config: Option<String>, | ||
|
||
/// Number of threads to run on, default to the numbers of logical cores on your system | ||
#[structopt(long, default_value = get_num_cpus())] | ||
pub num_threads: usize, | ||
|
||
/// Display only the necessary information | ||
#[structopt(long, short)] | ||
pub quiet: bool, | ||
|
||
#[structopt(parse(from_os_str), min_values(1), index(1), required(true))] | ||
pub files: Vec<OsString>, | ||
} | ||
|
||
// We can't just do default_value = num_cpus::get().to_string().as_str(), | ||
// since that won't extend the lifetime for long enough. | ||
fn get_num_cpus() -> &'static str { | ||
Box::leak(num_cpus::get().to_string().into_boxed_str()) | ||
} |