mirror of
https://github.com/qwjyh/xdbm
synced 2025-04-18 18:55:51 +09:00
change(sync)!: now it use git cli by default
This commit is contained in:
parent
0412233f86
commit
63c6c397c3
4 changed files with 12 additions and 11 deletions
|
@ -63,15 +63,15 @@ pub(crate) enum Commands {
|
|||
Sync {
|
||||
/// Remote name to sync.
|
||||
remote_name: Option<String>,
|
||||
/// Use custom git implementation.
|
||||
#[arg(short, long)]
|
||||
use_libgit2: bool,
|
||||
/// Whether to use ssh-agent
|
||||
#[arg(long)]
|
||||
use_sshagent: bool,
|
||||
/// Manually specify ssh key
|
||||
#[arg(long)]
|
||||
ssh_key: Option<PathBuf>,
|
||||
/// Use git command.
|
||||
#[arg(short, long)]
|
||||
use_cl: bool,
|
||||
},
|
||||
|
||||
/// Check config files validity.
|
||||
|
|
|
@ -12,12 +12,12 @@ pub(crate) fn cmd_sync(
|
|||
remote_name: Option<String>,
|
||||
use_sshagent: bool,
|
||||
ssh_key: Option<PathBuf>,
|
||||
use_cl: bool,
|
||||
use_libgit2: bool,
|
||||
) -> Result<()> {
|
||||
if use_cl {
|
||||
cmd_sync_cl(config_dir, remote_name, ssh_key)
|
||||
} else {
|
||||
if use_libgit2 {
|
||||
cmd_sync_custom(config_dir, remote_name, use_sshagent, ssh_key)
|
||||
} else {
|
||||
cmd_sync_cl(config_dir, remote_name, ssh_key)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -94,10 +94,10 @@ fn main() -> Result<()> {
|
|||
}
|
||||
Commands::Sync {
|
||||
remote_name,
|
||||
use_libgit2,
|
||||
use_sshagent,
|
||||
ssh_key,
|
||||
use_cl,
|
||||
} => cmd_sync::cmd_sync(&config_dir, remote_name, use_sshagent, ssh_key, use_cl)?,
|
||||
} => cmd_sync::cmd_sync(&config_dir, remote_name, use_sshagent, ssh_key, use_libgit2)?,
|
||||
Commands::Status {
|
||||
path,
|
||||
storage,
|
||||
|
|
|
@ -78,14 +78,14 @@ mod integrated_test {
|
|||
Command::cargo_bin("xdbm")?
|
||||
.arg("-c")
|
||||
.arg(config_dir)
|
||||
.args(["sync", "-vvvv", "-u"])
|
||||
.args(["sync", "-vvvv"])
|
||||
.assert()
|
||||
.success();
|
||||
} else {
|
||||
Command::cargo_bin("xdbm")?
|
||||
.arg("-c")
|
||||
.arg(config_dir)
|
||||
.args(["sync", "-vvvv"])
|
||||
.args(["sync", "-vvvv", "-u"])
|
||||
.assert()
|
||||
.success();
|
||||
}
|
||||
|
@ -338,6 +338,7 @@ mod integrated_test {
|
|||
.arg(config_dir_2.path())
|
||||
.arg("sync")
|
||||
.arg("-vvvv")
|
||||
.arg("-u")
|
||||
.assert()
|
||||
.success()
|
||||
.stderr(predicate::str::contains("successfully pushed"));
|
||||
|
|
Loading…
Add table
Reference in a new issue