Skip to content

Commit 80df7f6

Browse files
committed
pkgx --sync
Closes #1145
1 parent 20d1efc commit 80df7f6

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

crates/cli/src/args.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ pub struct Flags {
1313
pub json: bool,
1414
pub version_n_continue: bool,
1515
pub shebang: bool,
16+
pub sync: bool,
1617
}
1718

1819
pub struct Args {
@@ -34,6 +35,7 @@ pub fn parse() -> Args {
3435
let mut collecting_args = false;
3536
let mut version_n_continue = false;
3637
let mut shebang = false;
38+
let mut sync = false;
3739

3840
for arg in std::env::args().skip(1) {
3941
if collecting_args {
@@ -61,6 +63,7 @@ pub fn parse() -> Args {
6163
"--version" => mode = Mode::Version,
6264
"--quiet" => quiet = true,
6365
"--query" => mode = Mode::Query,
66+
"--sync" => sync = true,
6467
"--shellcode" => {
6568
if !silent {
6669
eprintln!("{}", style("⨯ migration required").red());
@@ -120,6 +123,7 @@ pub fn parse() -> Args {
120123
json,
121124
quiet,
122125
version_n_continue,
126+
sync,
123127
},
124128
}
125129
}

crates/cli/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ async fn main() -> Result<(), Box<dyn Error>> {
272272
println!("{}", json);
273273
}
274274
Ok(())
275-
} else if !flags.version_n_continue {
275+
} else if !flags.version_n_continue && !flags.sync {
276276
clear_progress_bar();
277277
eprintln!("{}", help::usage());
278278
std::process::exit(2);

crates/cli/src/setup.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ pub async fn setup(
2222
Some(spinner)
2323
};
2424

25-
let did_sync = if sync::should(&config)? {
25+
let did_sync = if flags.sync || sync::should(&config)? {
2626
if let Some(spinner) = &spinner {
2727
spinner.set_message("syncing pkg-db…");
2828
}

0 commit comments

Comments
 (0)