This commit is contained in:
@@ -5,15 +5,10 @@ use std::fs;
|
||||
use std::os::unix::fs::PermissionsExt;
|
||||
use std::path::PathBuf;
|
||||
|
||||
use clap::Parser;
|
||||
use clap::{Args as ClapArgs, Parser};
|
||||
|
||||
#[derive(Parser)]
|
||||
#[command(
|
||||
name = "gitea-kanban-tui",
|
||||
version,
|
||||
about = "Browse and move Gitea issues using native projects"
|
||||
)]
|
||||
pub struct Args {
|
||||
#[derive(Clone, Debug, ClapArgs)]
|
||||
pub struct SharedArgs {
|
||||
/// Gitea base URL; falls back to GITEA_URL
|
||||
#[arg(long)]
|
||||
pub url: Option<String>,
|
||||
@@ -37,6 +32,17 @@ pub struct Args {
|
||||
pub repo: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Parser)]
|
||||
#[command(
|
||||
name = "gitea-kanban-tui",
|
||||
version,
|
||||
about = "Browse and move Gitea issues using native projects"
|
||||
)]
|
||||
pub struct Args {
|
||||
#[command(flatten)]
|
||||
pub shared: SharedArgs,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct Config {
|
||||
pub base_url: String,
|
||||
@@ -64,6 +70,13 @@ impl Config {
|
||||
}
|
||||
|
||||
pub fn from_args_with<F>(args: Args, env_var: F) -> Result<Self, ConfigError>
|
||||
where
|
||||
F: Fn(&str) -> Option<String>,
|
||||
{
|
||||
Self::from_shared_args_with(args.shared, env_var)
|
||||
}
|
||||
|
||||
pub fn from_shared_args_with<F>(args: SharedArgs, env_var: F) -> Result<Self, ConfigError>
|
||||
where
|
||||
F: Fn(&str) -> Option<String>,
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user