# XBPS-TUI
An interactive terminal-based frontend for the `xbps` package manager, mainly
used by Void Linux.
Its still in an experimental alpha stage and might be unstable. I've heavily
tested all processes which need **root** permission, but as always with
applications which work with the root system, you could break something if
you're careless. I suggest always to use the `--dry-run` option and checking the
output (via `t`) before executing the real command with root permissions.
## Dependencies
For running the TUI you need the following programs installed:
- `xbps` package manager, or course!
- **Void Linux** as active OS (at least its only tested on Void).
- For authentication when running `root` commands, you need at least one of
these:
- `su` via `util-linux` package. Should be preinstalled on almost any system
- `polkit` for authentication when running root commands with a `polkit-agent`
to authenticate through password (try my
[`fuzzel`](https://codeberg.org/lukeflo/fuzzel-polkit-agent)-version if you
still need one :wink:)
_Note:_ You might ask: "Why `su` and not the more commonly used `sudo`?"
Well, that's due to the fact that `sudo` allows 3 password attempts by default,
while `su` only asks for the password one time and returns an error if it was
wrong. Changing `sudo` behavior is not easy to do, because it needs to edit some
system settings. Thus, `su` is an easier way to authenticate and directly return
an error value if the attempt failed.
## Installation
### Cargo
You can simply install the TUI via `cargo`:
```bash
cargo install xbps-tui
```
### Build from source
Or you build the TUI yourself:
```bash
git clone https://codeberg.org/lukeflo/xbps-tui
cd xbps-tui
```
Afterward, you can run the TUI via `target/release/xbps-tui` or simply
`xbps-tui`, if installed system-wide.
## CLI Arguments
Right now, `xbps-tui` only offers some very basic CLI flags:
| `-h`\|`--help` | Show the help text and exit |
| `-v`\|`--version` | Show the version text and exit |
| `--auth-method=<value>` | Set the authentication method for the upcoming session. Possible values are: `su`\|`sudo`\|`polkit`\|`pkexec`, whereas the first pair as well as the last pair are just synonyms for each other. The default value is `su`. |
## Actions
My goal was not to provide all functionalities `xbps` offers. They are far too
many. For rarely occurring use cases `xtools` offers some nice wrapper.
XBPS-Tui should make every-day tasks much more comfortable. Thus, the following
actions are implemented at the moment (though, I'll add some more, see Roadmap).
**Search Package List**
: By hitting `/` or `Ctrl+f` you enter search mode. This allows to fuzzy search
the current visible package list. The search pattern is matched against package
name and description. To search for a fixed pattern add a `'` at the beginning;
to search for a fixed string at the beginning of the package name add a `^`.
**Fast Filter List**
: By simply hitting `h`,`k` or `←`,`→` you can fast filter the list. The order
is: _full package list_ <> _installed packages_ <> _packages marked for
installation_ <> _packages marked for removal_.
**Mark Packages for Action**
: By hitting `space` the currently selected package gets marked. Installed
packages get will be marked for removal, not-installed packages for
installation. To remove a single mark, just hit `space` again on the selected
package. To remove all marks hit `c`.
**Run `xbps` Command and Check Output**
: To install all marked packages simply press `I`, to remove all marked packages
press `D`. A dialog with different execution options pops up. After selecting
one, you will be prompted for your `root` password. While the command is running
you can move the list or search for packages, but it's not possible to run
another command until the current one is finished. You can check the command
output which would normally appear on the command line by pressing `t`.
**Check package infos**
: You can open the related homepage of the currently selected package by
pressing `o`.
### Roadmap
- [x] Filter list by marked packages/installed packages
- [x] Authentication via `su`/`sudo`. This would make it possible to run all
tasks from inside the terminal.
- [ ] Opening links for selected package
- [ ] Fast installation/removal of single package
## Logs
Since `xbps-tui` runs some commands which need root permission, important
actions are logged. The logfile will be put into the standard data folder
following XDG standard. On most Linux machines this defaults to
`$HOME/.local/share/xbps-tui/xbps-tui.log`.
To change the location of the logfile temporary, pass the needed environment
flag right before starting `xbps-tui`:
`XBPS_TUI_DATA="relative/path/to/logfile" xbps-tui`.
## impressions
[](https://postimg.cc/XGpf3G6j)
_Searching the package list_
---
[](https://postimg.cc/Hjc8B1ty)
_Selection dialog for action_
---
[](https://postimg.cc/bd7D5V6F)
_Authentication using `polkit`_
---
[](https://postimg.cc/WdjDNFcG)
_CLI output from `xbps` command in scrollable popup_
## Feedback
I'm thankful for any feedback. Regarding the functionality of the TUI please
open an issue before opening a PR.
Feedback regarding code quality are also welcome, but for those kind please
don't open any PR. Writing this program is kind of a Rust training for me.
Therefore, I would like to implement code enhancements myself to learn something
too.