-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
implement default config locations
- Loading branch information
Showing
7 changed files
with
177 additions
and
19 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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,24 @@ | ||
use log::{Metadata, Record}; | ||
|
||
pub(crate) struct SimpleLogger(()); | ||
const LOGGER: &SimpleLogger = &SimpleLogger(()); | ||
|
||
impl SimpleLogger { | ||
pub(crate) fn init() -> Result<(), log::SetLoggerError> { | ||
log::set_logger(LOGGER) | ||
} | ||
} | ||
|
||
impl log::Log for SimpleLogger { | ||
fn enabled(&self, _metadata: &Metadata) -> bool { | ||
true | ||
} | ||
|
||
fn log(&self, record: &Record) { | ||
if self.enabled(record.metadata()) { | ||
eprintln!("{} {}: {}", record.level(), record.target(), record.args()); | ||
} | ||
} | ||
|
||
fn flush(&self) {} | ||
} |
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 |
---|---|---|
|
@@ -10,8 +10,10 @@ Project home page: https://github.com/Mydayyy/pbcli"; | |
|
||
#[derive(Debug, Parser, Clone)] | ||
#[cfg_attr(feature = "uniffi", derive(uniffi::Record))] | ||
#[clap(setting = clap::AppSettings::AllArgsOverrideSelf, version = env ! ("CARGO_PKG_VERSION"), author = "Mydayyy <[email protected]>", about = ABOUT)] | ||
#[clap(term_width(if let Some((terminal_size::Width(w), _)) = terminal_size::terminal_size() { w as usize } else { 120 }))] | ||
#[clap(setting = clap::AppSettings::AllArgsOverrideSelf, version = env ! ("CARGO_PKG_VERSION"), author = "Mydayyy <[email protected]>", about = ABOUT | ||
)] | ||
#[clap(term_width(if let Some((terminal_size::Width(w), _)) = terminal_size::terminal_size() { w as usize } else { 120 } | ||
))] | ||
#[clap(rename_all = "kebab-case")] | ||
pub struct Opts { | ||
#[clap(required_unless_present("host"), parse(try_from_str))] | ||
|
@@ -95,6 +97,16 @@ pub struct Opts { | |
#[clap(long)] | ||
#[clap(help("password to send to the token endpoint"))] | ||
pub oidc_password: Option<String>, | ||
|
||
#[cfg_attr(feature = "uniffi", uniffi(default = false))] | ||
#[clap(long)] | ||
#[clap(help("print debug output to stderr"))] | ||
pub debug: bool, | ||
|
||
#[cfg_attr(feature = "uniffi", uniffi(default = false))] | ||
#[clap(long)] | ||
#[clap(help("do not look for config in default locations"))] | ||
pub no_default_config: bool, | ||
} | ||
|
||
impl Opts { | ||
|