Skip to content

Commit 834d07f

Browse files
authored
Merge pull request #751 from imageworks/local-packages-flag
Change `--local-repo` short flag to `-L`
2 parents fe4dbf2 + 8d93ce1 commit 834d07f

File tree

2 files changed

+5
-26
lines changed

2 files changed

+5
-26
lines changed

crates/spk-cli/common/src/flags.rs

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ use std::sync::Arc;
77

88
use anyhow::{anyhow, bail, Context, Result};
99
use clap::{Args, ValueEnum};
10-
use colored::Colorize;
1110
use solve::{DecisionFormatter, DecisionFormatterBuilder, MultiSolverKind};
1211
use spk_schema::foundation::format::FormatIdent;
1312
use spk_schema::foundation::ident_build::Build;
@@ -707,12 +706,10 @@ where
707706

708707
#[derive(Args, Clone)]
709708
pub struct Repositories {
710-
/// Enable the local repository (DEPRECATED)
711-
///
712-
/// This option is ignored and the local repository is enabled by default.
709+
/// This option will enable the local repository only.
713710
/// Use `--no-local-repo` to disable the local repository.
714-
#[clap(short, long, value_parser = warn_local_flag_deprecated)]
715-
pub local_repo: bool,
711+
#[clap(short = 'L', long)]
712+
pub local_repo_only: bool,
716713

717714
/// Disable the local repository
718715
#[clap(long, hide = true)]
@@ -776,9 +773,6 @@ impl Repositories {
776773
/// This behavior can be altered with the `--enable-repo`, `--disable-repo`,
777774
/// and `--no-local-repo` flags.
778775
///
779-
/// For backwards compatibility purposes, if the deprecated `--local-repo`
780-
/// flag is used, then only the local repo is enabled.
781-
///
782776
/// The `--enable-repo` is considered additive instead of exclusive.
783777
///
784778
/// Remote repos enabled with `--enable-repo` are added to the list before
@@ -795,7 +789,7 @@ impl Repositories {
795789
let repo = storage::local_repository().await?;
796790
repos.push(("local".into(), repo.into()));
797791
}
798-
if self.local_repo {
792+
if self.local_repo_only {
799793
return Ok(repos);
800794
}
801795
for name in self
@@ -946,18 +940,3 @@ impl DecisionFormatterSettings {
946940
Ok(builder)
947941
}
948942
}
949-
950-
fn warn_local_flag_deprecated(arg: &str) -> Result<bool> {
951-
// This will be called with `"true"` if the flag is present on the command
952-
// line.
953-
if arg == "true" {
954-
// Logging is not configured at this point (args have to parsed to
955-
// know verbosity level before logging can be configured).
956-
eprintln!(
957-
"{warning}: The -l (--local-repo) is deprecated, please remove it from your command line!",
958-
warning = "WARNING".yellow());
959-
Ok(true)
960-
} else {
961-
Ok(false)
962-
}
963-
}

crates/spk-cli/group2/src/cmd_ls_test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ async fn test_ls_dash_l_shows_local_packages_only() {
180180
.await
181181
.unwrap();
182182

183-
let mut opt = Opt::try_parse_from(["ls", "-l"]).unwrap();
183+
let mut opt = Opt::try_parse_from(["ls", "-L"]).unwrap();
184184
opt.ls.run().await.unwrap();
185185
assert_eq!(opt.ls.output.vec.len(), 1);
186186
assert_eq!(opt.ls.output.vec.get(0).unwrap(), "my-local-pkg");

0 commit comments

Comments
 (0)