Skip to content

Commit

Permalink
Fix global -p option to work. (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
yoshihitoh committed Jul 6, 2019
1 parent 7e78b04 commit e791d66
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/config.rs
Expand Up @@ -3,6 +3,7 @@ use std::env;
static OFFSET_KEY: &'static str = "UT_OFFSET";
static PRECISION_KEY: &'static str = "UT_PRECISION";

#[derive(Debug)]
pub struct Config {
offset: Option<String>,
precision: Option<String>,
Expand Down
8 changes: 6 additions & 2 deletions src/main.rs
Expand Up @@ -71,9 +71,13 @@ fn config() -> Config {
fn run() -> Result<(), UtError> {
let app = app();
let config = config();
let precision = PrecisionArgv::default().parse_argv(config.precision().unwrap_or("second"))?;

let main_matches = app.get_matches();
let precision = PrecisionArgv::default().parse_argv(
main_matches
.value_of("PRECISION")
.or(config.precision())
.unwrap_or("second"),
)?;

if main_matches.is_present("UTC") {
let provider: UtcProvider = UtcProvider::from_timezone(Utc);
Expand Down

0 comments on commit e791d66

Please sign in to comment.