Work on config subcommand
This commit is contained in:
parent
6dca01fed7
commit
77cabd9e3e
2 changed files with 35 additions and 4 deletions
13
src/cli.rs
13
src/cli.rs
|
@ -1,5 +1,6 @@
|
|||
use crate::cli::prelude::*;
|
||||
|
||||
mod config;
|
||||
mod gitlab;
|
||||
mod jira;
|
||||
mod prelude;
|
||||
|
@ -13,16 +14,16 @@ pub struct Cli {
|
|||
#[command(subcommand)]
|
||||
pub command: Commands,
|
||||
|
||||
/// The directory to write log files (defaults to $XDG_CACHE_HOME/taskr/logs)
|
||||
#[arg(long, default_value = None)]
|
||||
pub logs_directory: Option<String>,
|
||||
|
||||
/// Define which tracing values are logged
|
||||
/// See https://docs.rs/tracing-subscriber/latest/tracing_subscriber/filter/struct.EnvFilter.html
|
||||
/// for details
|
||||
#[arg(long, default_value = None)]
|
||||
pub tracing_env_filter: Option<String>,
|
||||
|
||||
/// The directory to write log files (defaults to $XDG_CACHE_HOME/taskr/logs)
|
||||
#[arg(long, default_value = None)]
|
||||
pub logs_directory: Option<String>,
|
||||
|
||||
/// The directory that data is stored in (defaults to $XDG_DATA_HOME/taskr/data)
|
||||
#[arg(long, default_value = None)]
|
||||
pub data_directory: Option<String>,
|
||||
|
@ -58,6 +59,10 @@ pub enum Commands {
|
|||
/// Interact with the configured GitLab endpoint
|
||||
#[command(subcommand)]
|
||||
Gitlab(gitlab::Command),
|
||||
|
||||
/// Interact with the configured GitLab endpoint
|
||||
#[command(subcommand)]
|
||||
Config(config::Command),
|
||||
}
|
||||
|
||||
#[derive(Args)]
|
||||
|
|
26
src/cli/config.rs
Normal file
26
src/cli/config.rs
Normal file
|
@ -0,0 +1,26 @@
|
|||
use crate::cli::prelude::*;
|
||||
|
||||
#[derive(Subcommand)]
|
||||
pub enum Command {
|
||||
Show,
|
||||
}
|
||||
|
||||
impl Command {
|
||||
pub async fn exec(&self, tasks: SharedTasks) -> Result<()> {
|
||||
match self {
|
||||
Command::Show => self.show().await,
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn show(&self) -> Result<()> {}
|
||||
}
|
||||
|
||||
#[derive(Parser)]
|
||||
pub struct MeArgs {}
|
||||
|
||||
impl MeArgs {
|
||||
pub async fn me(&self, tasks: SharedTasks) -> Result<()> {
|
||||
println!("{:#?}", tasks.gitlab()?.me().await?);
|
||||
Ok(())
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue