Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: use default config path when no arg for -f is provided #2939

Merged
merged 2 commits into from
Jan 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/1706.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
make `-f` flag accept optional argument, defaulting to "./.mirrord/mirrord.json" when no argument is provided
15 changes: 9 additions & 6 deletions mirrord/cli/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,8 @@ pub(super) struct ExecParams {
pub disable_version_check: bool,

/// Load config from config file
#[arg(short = 'f', long, value_hint = ValueHint::FilePath)]
/// When using -f flag without a value, defaults to "./.mirrord/mirrord.json"
#[arg(short = 'f', long, value_hint = ValueHint::FilePath, default_missing_value = "./.mirrord/mirrord.json", num_args = 0..=1)]
pub config_file: Option<PathBuf>,

/// Kube context to use from Kubeconfig
Expand Down Expand Up @@ -426,7 +427,8 @@ pub(super) struct PortForwardArgs {
pub disable_version_check: bool,

/// Load config from config file
#[arg(short = 'f', long, value_hint = ValueHint::FilePath)]
/// When using -f flag without a value, defaults to "./.mirrord/mirrord.json"
#[arg(short = 'f', long, value_hint = ValueHint::FilePath, default_missing_value = "./.mirrord/mirrord.json", num_args = 0..=1)]
pub config_file: Option<PathBuf>,

/// Kube context to use from Kubeconfig
Expand Down Expand Up @@ -587,7 +589,7 @@ pub(super) enum OperatorCommand {
/// Print operator status
Status {
/// Specify config file to use
#[arg(short = 'f', long, value_hint = ValueHint::FilePath)]
#[arg(short = 'f', long, value_hint = ValueHint::FilePath, default_missing_value = "./.mirrord/mirrord.json", num_args = 0..=1)]
config_file: Option<PathBuf>,
},
/// Operator session management commands.
Expand Down Expand Up @@ -727,7 +729,7 @@ impl ListTargetArgs {
#[derive(Args, Debug)]
pub(super) struct ExtensionExecArgs {
/// Specify config file to use
#[arg(short = 'f', long, value_hint = ValueHint::FilePath)]
#[arg(short = 'f', long, value_hint = ValueHint::FilePath, default_missing_value = "./mirrord.json", num_args = 0..=1)]
pub config_file: Option<PathBuf>,
/// Specify target
#[arg(short = 't')]
Expand Down Expand Up @@ -766,7 +768,7 @@ pub(super) enum DiagnoseCommand {
/// Check network connectivity and provide RTT (latency) statistics.
Latency {
/// Specify config file to use
#[arg(short = 'f', long, value_hint = ValueHint::FilePath)]
#[arg(short = 'f', long, value_hint = ValueHint::FilePath, default_missing_value = "./.mirrord/mirrord.json", num_args = 0..=1)]
config_file: Option<PathBuf>,
},
}
Expand Down Expand Up @@ -895,7 +897,8 @@ pub(super) struct VpnArgs {
pub namespace: Option<String>,

/// Load config from config file
#[arg(short = 'f', long, value_hint = ValueHint::FilePath)]
/// When using -f flag without a value, defaults to "./.mirrord/mirrord.json"
#[arg(short = 'f', long, value_hint = ValueHint::FilePath, default_missing_value = "./.mirrord/mirrord.json", num_args = 0..=1)]
pub config_file: Option<PathBuf>,

#[cfg(target_os = "macos")]
Expand Down
Loading