Skip to content

Commit

Permalink
Rename -C --upgrade to --sysupgrade and -Lu to -Ly
Browse files Browse the repository at this point in the history
  • Loading branch information
Morganamilo committed Feb 15, 2022
1 parent 19fd836 commit 0bace84
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 12 deletions.
4 changes: 2 additions & 2 deletions completions/bash
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ _paru() {

show=('news stats' 'w s')
getpkgbuild=('print comments' 'p c')
chrootctl=('upgrade install' 'u i')
repoctl=('quiet list delete' 'q l d')
chrootctl=('sysupgrade install' 'u i')
repoctl=('quiet list delete refresh' 'q l d y')

for o in 'D database' 'F files' 'Q query' 'R remove' 'S sync' 'U upgrade' 'P show' 'G getpkgbuild' 'C chrootctl' 'L repoctl'; do
_arch_incomp "$o" && break
Expand Down
3 changes: 2 additions & 1 deletion completions/fish
Original file line number Diff line number Diff line change
Expand Up @@ -178,10 +178,11 @@ complete -c $progname -n "$getpkgbuild" -xa "$listall"
complete -c $progname -n "$repoctl" -s l -l list -d 'List packages in local repos' -f
complete -c $progname -n "$repoctl" -s d -l delete -d 'Remove a package from the local repo' -f
complete -c $progname -n "$repoctl" -s q -l quiet -d 'Show less information' -f
complete -c $progname -n "$repoctl" -s y -l refresh -d 'Refresh local repos' -f

# Chrootctl options
complete -c $progname -n "$chrootctl" -s l -l install -d 'Install a package into the chroot' -f
complete -c $progname -n "$chrootctl" -s u -l upgrade -d 'Upgrade the chroot' -f
complete -c $progname -n "$chrootctl" -s u -l sysupgrade -d 'Upgrade the chroot' -f

# New options
complete -c $progname -n "not $noopt" -l repo -d 'Assume targets are from the repositories' -f
Expand Down
3 changes: 2 additions & 1 deletion completions/zsh
Original file line number Diff line number Diff line change
Expand Up @@ -167,12 +167,13 @@ _pacman_opts_repoctl_modifiers=(
{-l,--list}'[List packages in local repos]'
{-d,--delete}"[Remove a package from the local repo]"
{-q,--quiet}'[Show less information]'
{-y,--refresh}'[Refresh local repos]'
)

# -L
_pacman_opts_chrootctl_modifiers=(
{-i,--install}'[Install a package into the chroot]'
{-u,--upgrade}'[Upgrade the chroot]'
{-u,--sysupgrade}'[Upgrade the chroot]'
)

# -P
Expand Down
6 changes: 5 additions & 1 deletion man/paru.8
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,10 @@ List packages in local repos
Remove a package from the local repo.
Pass this twice to also uninstall the package.

.TP
.B \-y, \-\-refresh
Refresh local repos.

.TP
.B \-q, \-\-quiet
Show less information.
Expand All @@ -215,7 +219,7 @@ Show less information.
Install a package into the chroot.

.TP
.B \-u, \-\-upgrade
.B \-u, \-\-sysupgrade
Upgrade the chroot.

.SH UPGRADE OPTIONS (APPLY TO \-U AND \-\-UPGRADE)
Expand Down
3 changes: 2 additions & 1 deletion src/command_line.rs
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,8 @@ impl Config {
self.comments = true;
}
Arg::Long("install") | Arg::Short('i') => self.install = true,
Arg::Long("update") | Arg::Short('u') => self.update = true,
Arg::Long("sysupgrade") | Arg::Short('u') => self.sysupgrade = true,
Arg::Long("refresh") | Arg::Short('y') => self.refresh = true,
Arg::Long("quiet") | Arg::Short('q') => self.quiet = true,
Arg::Long("list") | Arg::Short('l') => self.list = true,
Arg::Long("delete") | Arg::Short('d') => self.delete += 1,
Expand Down
3 changes: 2 additions & 1 deletion src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,8 @@ pub struct Config {
pub chroot: bool,
pub install: bool,
pub uninstall: bool,
pub update: bool,
pub sysupgrade: bool,
pub refresh: bool,
pub quiet: bool,
pub list: bool,
pub delete: u32,
Expand Down
8 changes: 4 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ fn handle_repo(config: &mut Config) -> Result<i32> {
.filter(|r| config.delete >= 1 || config.targets.is_empty() || config.targets.contains(r))
.collect::<Vec<_>>();

if config.update {
if config.refresh {
repo::refresh(config, &repos)?;
}

Expand Down Expand Up @@ -380,7 +380,7 @@ fn handle_repo(config: &mut Config) -> Result<i32> {
return Ok(0);
}

if config.update {
if config.refresh {
return Ok(0);
}

Expand Down Expand Up @@ -455,15 +455,15 @@ fn handle_chroot(config: &Config) -> Result<i32> {
chroot.create(config, &["base-devel"])?;
}

if config.update {
if config.sysupgrade {
chroot.update()?;
}

if config.install {
let mut args = vec!["pacman", "-S"];
args.extend(config.targets.iter().map(|s| s.as_str()));
chroot.run(&args)?;
} else if !config.update || !config.targets.is_empty() {
} else if !config.sysupgrade || !config.targets.is_empty() {
chroot.run(&config.targets)?;
}
Ok(0)
Expand Down
2 changes: 1 addition & 1 deletion src/repo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ pub fn refresh<S: AsRef<OsStr>>(config: &mut Config, repos: &[S]) -> Result<i32>

cmd.arg("--dbpath")
.arg(config.alpm.dbpath())
.arg("-Lu")
.arg("-Ly")
.args(repos);

let status = cmd.spawn()?.wait()?;
Expand Down

0 comments on commit 0bace84

Please sign in to comment.