Skip to content

Commit

Permalink
feat(-A): enable --reverse to be always active via config
Browse files Browse the repository at this point in the history
See #722
  • Loading branch information
fosskers committed Jul 31, 2024
1 parent 3fd459b commit 6d58280
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 3 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Aura Changelog

## Unreleased

#### Added

- `-As --reverse` can be turned on permanently in config.

## 4.0.0 (2024-07-31)

Aura 4 represents a signicant body of work to port Aura from Haskell to Rust.
Expand Down
3 changes: 3 additions & 0 deletions misc/aura.texi
Original file line number Diff line number Diff line change
Expand Up @@ -1648,6 +1648,9 @@ See @code{aura stats --lang} for available language codes.
@item skipdepcheck
@tab bool
@tab Don't perform dependency checking at all
@item reverse
@tab bool
@tab Always reverse the search results
@end multitable

@heading Package Snapshots
Expand Down
10 changes: 10 additions & 0 deletions rust/aura-pm/src/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,8 @@ struct RawAur {
noconfirm: bool,
#[serde(default)]
nocheck: bool,
#[serde(default)]
reverse: bool,
}

#[derive(Debug, Serialize)]
Expand Down Expand Up @@ -332,6 +334,8 @@ pub(crate) struct Aur {
/// (Makepkg) Do not verify source files with PGP signatures.
#[serde(skip_serializing)]
pub(crate) skippgpcheck: bool,
/// Always reverse the search results.
pub(crate) reverse: bool,
}

impl Aur {
Expand All @@ -356,6 +360,7 @@ impl Aur {
skipdepcheck: false,
skipinteg: false,
skippgpcheck: false,
reverse: false,
};

Ok(a)
Expand Down Expand Up @@ -419,6 +424,10 @@ impl Aur {
self.skippgpcheck = true;
}

if flags.reverse {
self.reverse = true;
}

// Harmless clone, as we don't expect many "ignores" to be passed on the
// command line.
self.ignores.extend(flags.ignore.clone());
Expand Down Expand Up @@ -453,6 +462,7 @@ impl TryFrom<RawAur> for Aur {
skipdepcheck: false,
skipinteg: false,
skippgpcheck: false,
reverse: raw.reverse,
};

Ok(a)
Expand Down
11 changes: 8 additions & 3 deletions rust/aura-pm/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,14 @@ fn work(args: Args, env: Env, fll: &FluentLanguageLoader) -> Result<(), Error> {
SubCmd::Upgrade(u) => pacman(&env, u.needs_sudo())?,
// --- AUR Packages --- //
SubCmd::Aur(a) if a.info.is_empty().not() => aur::info(fll, &a.info)?,
SubCmd::Aur(a) if a.search.is_empty().not() => {
aur::search(&env.alpm()?, a.abc, a.reverse, a.limit, a.quiet, a.search)?
}
SubCmd::Aur(a) if a.search.is_empty().not() => aur::search(
&env.alpm()?,
a.abc,
env.aur.reverse,
a.limit,
a.quiet,
a.search,
)?,
SubCmd::Aur(a) if a.provides.is_some() => aur::provides(
&env.alpm()?,
a.abc,
Expand Down

0 comments on commit 6d58280

Please sign in to comment.