I started work on my bash script that automatically finds the use of a given command, as well as where to download the package that uses the command.
First, I looked for and found a few APIs I wanted to use for this project. I settled on
https://command-not-found.com
and https://cheat.sh
for my main, and for the backup, in case command-not-found.com goes down, I went with https://packages.debian.org/search?keywords=.
Originally, when you put in, for example, firefox, the code was structured like as follows:
INSTALL_APT=“sudo apt install $COMMAND”
INSTALL_PACMAN=“sudo pacman -S $COMMAND”
INSTALL_DNF=“sudo dnf install $COMMAND”
INSTALL_ZYP=“sudo zypper install $COMMAND”
INSTALL_BREW=“brew install $COMMAND”
INSTALL_SNAP=“sudo snap install $COMMAND”
this basically meant that it would always tell you:
Installation Commands:
Debian/Ubuntu (APT): sudo apt install firefox
Arch Linux (Pacman): sudo pacman -S firefox
Fedora/RedHat (DNF): sudo dnf install firefox
openSUSE (Zypper): sudo zypper install firefox
macOS/Linux (Brew): brew install firefox
Universal (Snap): sudo snap install firefox
which is clearly NOT RIGHT
The solution was to use the APIs (as mentioned before) to look for the methods of installation. I’m now working on getting the local status of packages and displaying that, as well as using local information of the packages BEFORE using the APIs to fetch.
Comments 0
No comments yet. Be the first!
Sign in to join the conversation.