Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shell: provide set of aliases out-of-the-box #675

Closed
1 of 3 tasks
ratijas opened this issue Nov 24, 2020 · 12 comments
Closed
1 of 3 tasks

Shell: provide set of aliases out-of-the-box #675

ratijas opened this issue Nov 24, 2020 · 12 comments
Labels
request A feature request from a user.

Comments

@ratijas
Copy link
Contributor

ratijas commented Nov 24, 2020

Summary

This is feature request to include aliases for commonly used aura operations (e.g.: search, install, remove, inspect etc.) primarily for bash and zsh.

Description

Oh-my-zsh, despite being huge unwieldy bloatware, occasionally ships some useful plugins, most of which are sets of aliases. I'm no longer a direct user of oh-my-zsh, instead I just copied over my favorite parts to my personal dotfiles repository, but whatever.

One such plugin is for Arch Linux — mainly about pacman and AUR helpers. It lacks aura support at the moment.

The benefit of having such predefined bunch of aliases is huge:

  • it comes out-of-the-box,
  • it would likely be available on a different machine with similar setup,
  • it saves typing and guesswork,
  • it allows simpler tab completion,
  • it educates users about most common workflows (for example, long ago I learned a lot from inspecting git aliases, and I'm still using glo* family when I'm too lazy to open Sublime Merge).

Now, I'm not sure what's the best way to distribute bash/zsh aliases via system package manager. But at least we can add support for aura to oh-my-zsh upstream.

Aliases

Here's what I would like to see there (based on the aforementioned plugin).

Alias Command Description
auin sudo aura -S Install packages from the repositories
aurin sudo aura -A Install packages from the repositories
auins sudo aura -U Install a package from a local file
auinsd sudo aura -S --asdeps Install packages as dependencies of another package (repositories only)
aurinsd sudo aura -A --asdeps Install packages as dependencies of another package (AUR only)
auloc aura -Qi Display information about a package in the local database
aulocs aura -Qs Search for packages in the local database
auls aura -Qql List all files owned by a given package
aulst aura -Qe List installed packages including from AUR (tagged as "local")
aumir sudo aura -Syy Force refresh of all package lists after updating mirrorlist
aurph sudo aura -Oj Remove orphans using aura
auown aura -Qqo Search for packages that own the specified file(s)
aure sudo aura -R Remove packages, keeping its settings and dependencies
aurem sudo aura -Rns Remove packages, including its settings and unneeded dependencies
aurep aura -Si Display information about a package in the repositories
aurrep aura -Ai Display information about a package from AUR
aureps aura -As --both Search for packages in the repositories and AUR
auras aura -As --both Same as above
auupd sudo aura -Sy && <abs/aur refresh>¹ Update and refresh local package, ABS and AUR databases
auupg sudo sh -c "aura -Syu && aura -Au" Sync with repositories before upgrading all packages (from AUR too)
ausu sudo sh -c "aura -Syu --no-confirm && aura -Au --no-confirm" Same as auupg, but without confirmation
upgrade³ sudo aura -Syu Sync with repositories before upgrading packages
Function Description
auownloc file Display information about a package that owns the specified file(s)
auownls file List all files owned by a package that owns the specified file(s)

¹ Which alias is selected depends on avaliability of the corresponding commands in PATH.
³ The upgrade alias is set for all package managers. Its value will depend on
whether the package manager is installed, checked in the following order:

  1. yay
  2. yaourt
  3. trizen
  4. pacaur
  5. aura
  6. pacman

Questions

  • What do we do about aurep='aura -Si'? There's no flag combination to show info for either repos or AUR at once. Because reasons, namely, pHiLoSoPhY.
  • auin, auinsd wouldn't work on AUR packages for the same... cough... reasons as above.
  • Should we prefix most of aliases with sudo?
    Pacaur asks user for elevated permissions on the go as it needs them, but aura requires upfront execution under sudo.
    -- Yes, In the end I think sudo prefixes are required.

Version

$ aura -Qi aura
Name            : aura-bin
Version         : 3.2.2-1

Oh-My-Zsh Arch Linux plugin: https://github.com/ohmyzsh/ohmyzsh/tree/b94bdf8927935419a228a1ba21408a36125513f7/plugins/archlinux
Relevant PR: ohmyzsh/ohmyzsh#9467 (merged).

@ratijas
Copy link
Contributor Author

ratijas commented Nov 24, 2020

❯ aurrep bat
aura >>= No packages found.
❯ aurep bat
Repository      : community
Name            : bat
Version         : 0.16.0-1
...

That's no philosophy. That's called dump inconvenience. There's already Repository : line to tell whether a package is from AUR or elsewhere.


❯ auin bat
error: you cannot perform this operation unless you are root.
❯ sudo auin bat
[sudo] password for ratijas: 
sudo: auin: command not found

And this is why apps built in a last century used to request elevated permissions as they need them (UID!=0, polkit et al.)

@fosskers
Copy link
Owner

There's no flag combination to show info for either repos or AUR at once. Because reasons, namely, pHiLoSoPhY.

How about aureb?

error: you cannot perform this operation unless you are root.

Aura follows Pacman's behaviour here.

@ratijas
Copy link
Contributor Author

ratijas commented Nov 24, 2020

Aura follows Pacman's behaviour here.

... and if you want to define an alias for pacman, you have to move sudo inside. Oh-my-zsh plugin exhibits exactly that behavior.

By the way, mimicking pacman may not be the best way to do things. Sure it gives familiarity vibes, but it should not be a stopper against implementing convenient features.

How about aureb?

Maayyybe.... Sounds a little bit weird though~ But it's a phonetically hard equivalent of "p" alright.

@fosskers
Copy link
Owner

fosskers commented Nov 25, 2020

That, and it reflects the bothness of the search.

By the way, mimicking pacman may not be the best way to do things. Sure it gives familiarity vibes, but it should not be a stopper against implementing convenient features.

And indeed other major tools don't seem to force sudo right away. I'll consider this for the Rust rewrite. It would actually improve a number of issues, now that I think.

@ratijas
Copy link
Contributor Author

ratijas commented Nov 29, 2020

I have noticed, I'm heavily using -Qo and -Qql often in conjunction with each other and with fzf in preview mode, and none of those are aliased. They have to be added.

I propose auown and auls respectively. And then something on top of them:

function auownloc() { aura -Qi  $(aura -Qqo $@); }
function auownls () { aura -Qql $(aura -Qqo $@); }

Former might be a bit long, but it is easy to type and remember. With such functions it is easy to use !$ (previous command's last argument) in your workflow, where !$ would refer to the same file over and over again.

@ratijas
Copy link
Contributor Author

ratijas commented Dec 25, 2020

Updated from latest commit to my pull request to oh-my-zsh repo.

There's nothing more I'd like to add. I used these aliases in my day-to-day workflow for a while, and it feels like it's the best it can ever get. Except for GOTDAYUMIT WHY REQUIRE TWO DIFFERENT ALIASES TO SHOW INFO WHY. Apart from that I'm pretty happy with them as they are.

Might as well add few lines to the README to instruct folks how to install that plugin from ohmyzsh to their setup.

@fosskers
Copy link
Owner

Adding it to the book would also be very helpful. The book files are just .md files, so you can edit them in the usual way. If you want to render the book locally to test your changes, check out https://github.com/rust-lang/mdBook .

@ratijas
Copy link
Contributor Author

ratijas commented Apr 6, 2021

Hello there,

Thanks to Oh-My-Zsh stuff, ohmyzsh/ohmyzsh#9467 has been resurrected and finally merged. I'm gonna update the top post for the last time. And then I shall submit a PR to the book, right?

@fosskers
Copy link
Owner

fosskers commented Apr 6, 2021

Sure, that would be great! Thank you.

@ratijas
Copy link
Contributor Author

ratijas commented May 12, 2021

Please, remind me that I should finish it someday...

@fosskers
Copy link
Owner

Please finish this someday. 😆

@fosskers
Copy link
Owner

Shall we close this?

@fosskers fosskers added the request A feature request from a user. label Jul 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
request A feature request from a user.
Projects
None yet
Development

No branches or pull requests

2 participants