Move expiry constants to CLI module
Move the constants `SECONDS_IN_DAY` and `SECONDS_IN_YEAR` to the CLI module so that they can be used there and export them in the top-level module agaian so that they can be used elsewhere as well.
This commit is contained in:
parent
4587269d1f
commit
5033e8842b
@ -63,6 +63,8 @@ use clap::FromArgMatches;
|
||||
mod sq_cli;
|
||||
use sq_cli::packet;
|
||||
use sq_cli::SqSubcommands;
|
||||
use sq_cli::SECONDS_IN_DAY;
|
||||
use sq_cli::SECONDS_IN_YEAR;
|
||||
|
||||
mod man;
|
||||
mod commands;
|
||||
@ -80,11 +82,6 @@ fn open_or_stdin(f: Option<&str>)
|
||||
}
|
||||
}
|
||||
|
||||
const SECONDS_IN_DAY : u64 = 24 * 60 * 60;
|
||||
const SECONDS_IN_YEAR : u64 =
|
||||
// Average number of days in a year.
|
||||
(365.2422222 * SECONDS_IN_DAY as f64) as u64;
|
||||
|
||||
fn parse_duration(expiry: &str) -> Result<Duration> {
|
||||
let mut expiry = expiry.chars().peekable();
|
||||
|
||||
|
@ -32,6 +32,13 @@ pub mod wot;
|
||||
|
||||
pub mod types;
|
||||
|
||||
/// The seconds in a day
|
||||
pub const SECONDS_IN_DAY : u64 = 24 * 60 * 60;
|
||||
/// The seconds in a year
|
||||
pub const SECONDS_IN_YEAR : u64 =
|
||||
// Average number of days in a year.
|
||||
(365.2422222 * SECONDS_IN_DAY as f64) as u64;
|
||||
|
||||
pub fn build() -> Command {
|
||||
let sq_version = Box::leak(
|
||||
format!(
|
||||
|
Loading…
Reference in New Issue
Block a user