feat: add log_dir to dfget args (#14)

Signed-off-by: Gaius <gaius.qi@gmail.com>
This commit is contained in:
Gaius 2023-04-20 20:01:46 +08:00 committed by GitHub
parent c09b340ac7
commit 2ff8e788f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 13 deletions

View File

@ -15,6 +15,7 @@
*/ */
use clap::Parser; use clap::Parser;
use client::config::dfget::*;
use std::path::PathBuf; use std::path::PathBuf;
use tracing::Level; use tracing::Level;
@ -34,9 +35,6 @@ struct Args {
)] )]
output: PathBuf, output: PathBuf,
#[arg(short = 'c', long = "config", help = "Specify config file to use")]
config: PathBuf,
#[arg( #[arg(
short = 'l', short = 'l',
long, long,
@ -46,12 +44,11 @@ struct Args {
log_level: Level, log_level: Level,
#[arg( #[arg(
short,
long, long,
default_value_t = false, default_value_os_t = default_dfget_log_dir(),
help = "Print more information about the download progress" help = "Specify the log directory"
)] )]
verbose: bool, log_dir: PathBuf,
} }
fn main() { fn main() {

View File

@ -14,14 +14,9 @@
* limitations under the License. * limitations under the License.
*/ */
use crate::config::{default_config_dir, default_log_dir}; use crate::config::default_log_dir;
use std::path::PathBuf; use std::path::PathBuf;
// default_dfget_config_path is the default config path for dfget.
pub fn default_dfget_config_path() -> PathBuf {
default_config_dir().join("dfget.yaml")
}
// default_dfget_log_dir is the default log directory for dfget. // default_dfget_log_dir is the default log directory for dfget.
pub fn default_dfget_log_dir() -> PathBuf { pub fn default_dfget_log_dir() -> PathBuf {
default_log_dir().join("dfget") default_log_dir().join("dfget")