Load a menu of shells/files from a provided JSON configuration file. Version 2 - C++ rewrite.
- About
- Usage
- Examples
- Media
- Contribute
- Build Status And Project Information
- LICENSE
Version 2 of UniShellect.
Version 1 was written in Fortran and has a slight bug in the JSON parsing that I'd prefer not to fix as I wanted to write this new version anyway. The bug causes the program to not be able to parse more than 9 entries. Version 2 is written in C++ and negates this issue.
This tool parses a JSON configuration file and loads a highly customizable menu of shells, interpreters, files, commands and possible arguments into any command line interface. Various configuration files can be loaded and this can be great for loading various menus based on various criteria: E.g. project menus, work menus, game menus, etcetera.
You can also set sub-menus by using unishellect itself as the Path and pass the sub menu file as the Args.
This is a cross-platform FOSS project.
This is inspired by the hyper-shellect plug-in for the Hyper terminal which is dependent on node.js.
This particular version was inspired from the need for a rewrite of original.
I work and play in all sorts of command line environments in both Windows and Linux and this helps me organize and navigate that world more efficiently and smoothly.
When, where, and how to use this program.
This is an open-source (FOSS) command line utility for use in Linux, Windows, and Android shells (terminals/ttys/Termux/etc.). This can be built from source (as per the LICENSE file provided), used portably (single executable put wherever you like), or installed via the provided Debian (.deb) package. An AppImage for the Linux version is provided as well.
The recommended method of use is via the Debian package installation for the Debian (apt, deb) packager manager, but there are other methods provided here or if you would care to provide an installer for a different package manager then please fork this project, build the appropriate workflow and source files, and make a pull-request. More information about contributing here.
All currently built and released files can be found at the releases page:
I personally recommend this method as it automatically installs a basic Bash Completion file, a hicolor icon theme, and a man page entry.
- Download and install the current .deb installer file at the releases page.
- Use one of various command line tools to install the package:
- APT
sudo apt install /path/to/unishellect-2.0.1661201987.deb -y # -y to skip affirmation, not necessary
- DPKG
sudo dpkg -i /path/to/unishellect-2.0.1661201987.deb
- GDEBI
gdebi-gtk /path/to/unishellect-2.0.1661201987.deb # or sudo gdebi /path/to/unishellect-2.0.1661201987.deb
The deb installer provides a few features (among providing a way to cleany install and uninstall all features):
The Bash Completion File provides basic Bash completion for switches and parameters and is installed to /usr/share/bash-completion/completions/unishellect
when installed with the deb package.
More infomation can be found here:
The deb package installer provide an icon theme for HiColor in case you want to make a .desktop shortcut or anything else. Icons are installed to /usr/share/icons/hicolor/{16,32,48,64,128,256}/apps/unishellect.png
.
The manual page is a more advanced verion of a Help Message and can be accessed from the command line via: man unishellect
.
$ man unishellect
NAME
unishellect - Load a menu of shells/files from a provided JSON configuration file.
SYNOPSIS
unishellect [OPTIONS [FILE]]...
DESCRIPTION
Load a menu of shells/files from a provided JSON configuration file.
The default configuration file is located in:
$HOME/.config/UniShellect/unishellect.json in Linux and:
%USERPROFILE%\.config\UniShellect\unishellect.json
in Windows.
OPTIONS
-h, --help
This HELP message.
-c, --config
Load an alternate configuration FILE.
-m, --monochrome
All output is monochrome; no color.
EXAMPLES
$ unishellect
$ unishellect --help
$ unishellect --monochrome
$ unishellect --config ~/.config/UniShellect/<MY_ALTERNATE_CONFIG>.json
EXIT CODES
0 No errors.
1 Too many options passed to the program.
2 Could not get the value of HOME from the environment.
3 User cancelled/interrupted.
4 No FILE/argument provided for the -c,–config OPTION.
101 Error while parsing JSON in a config file.
other Any additional errors are related to opening and reading from the provided config file.
CONTACT
Ian Pride (faithnomoread@yahoo.com)
This Project ('https://github.com/Lateralus138/unishellectv2')
GitHub ('https://github.com/Lateralus138')
Twitter ('https://twitter.com/TheFluxApex')
AUTHORS
Ian Pride.
unishellect - 2.0.1661201987 Mon 22 Aug 2022 08:59:47 PM UTC UNISHELLECT(1)
As with any executable file in most operating systems if this is not installed to $PATH
(or %PATH% in Windows) then you must provide the full path when you run it. If it is in your $PATH
then you can just run it with the file name.
# In $PATH
$ unsihellect --help
# Not in $PATH
$ /full/or/relative/path/to/unishellect --help
You can use this portably by downloading the unishellect
executable bin file from the releases page and putting it anywhere you like; most preferably in one of your $PATH
(echo $PATH
) directories.
The AppImage is essentially all the files provided in the deb install, but in a portable container. This version is not necessary, but provided for those who perfer containers. It is used in the exact same way as the portable Linux version.
The AppImage is essentially all the files provided in the deb install, but in a portable container. This version is not necessary, but provided for those who perfer containers. It is used in the exact same way as the portable Linux version.
The Android executables ( .aarch64) is portable and should probably be installed to /data/data/com.termux/files/usr/bin/unishellect
(removing the extensions if you like). I plan to build a deb installer in the future.
As with the other versions the Windows version is portable and can be placed where you place your portable programs. I personally tend to have a Bin folder either in C:\Windows\Bin
or %USERPROFILE%\Bin (C:\Users\<USERNAME>\Bin)
. This is up to your preference. Just like the other versions the same rules of %PATH%
apply in Windows and if you have a Bin folder make sure it's in your
%PATH%
otherwise you need to supply the full path as usual.
Bash completion can be provided by placing the unishellect Bash completion file to /usr/share/bash-completion/completions
. This is already done if installed with a package manager.
unishellect Bash Completion File:
unishellect_list=(
-h --help
-c --config
-m --monochrome
)
complete -W "$(printf '%s\n' "${unishellect_list[@]}")" unishellect
This is the basis of the JSON configuration file:
{
"Shells": [
{
"Title": "Example Title",
"Path": "command_or_path_to_excutable",
"Args": "-a 'Any additional arguments'"
}
]
}
and can run any combination of path/command and arguments including unishellect itself to create subpoenas:
{
"Shells": [
{
"Title": "Sub Menu 1",
"Path": "unishellect",
"Args": "-c '/path/to/config/menufile.1.json'"
},
{
"Title": "Sub Menu 2",
"Path": "unishellect",
"Args": "-c '/path/to/config/menufile.2.json'"
}
]
}
This information is generated in a GitHub Action immediately after the successful build of this project.
$ unishellect --help
┌────────────────────────────────────────────────┐
│ UniShellect │
├────────────────────────────────────────────────┤
│ USAGE: unishellect [OPTIONS [FILE]...]... │
│ Load a menu of shells/files from a provided │
│ JSON configuration file. The default is: │
│ $HOME/.config/UniShellect/unishellect.json │
│ in Linux and: │
│ %USERPROFILE%\\.config\\UniShellect- │
│ \\unishellect.json │
│ in Windows. │
├────────────────────────────────────────────────┤
│ OPTIONS: switches and arguments │
│ -h,--help This HELP message. │
│ -c,--config Load an alternate config │
│ file. │
│ -m,--monochrome All output is monochrome; │
│ no color. │
├────────────────────────────────────────────────┤
│ Exit Codes: Error codes and their meanings. │
│ 0 No errors. │
│ 1 Too many options passed to the │
│ program. │
│ 2 Could not get the value of HOME from │
│ the environment. │
│ 3 User cancelled/interrupted. │
│ 4 No FILE/argument provided for the │
│ -c,--config OPTION. │
│ 101 Error while parsing JSON in a config │
│ file. │
│ * Any additional errors are related to │
│ opening and reading from the provided │
│ config file. │
└────────────────────────────────────────────────┘
Using the default configuration file unishellect.json
located in %USERPROFILE%\.config\UniShellect\
in Windows or $HOME/.config/UniShellect/
everywhere else. You must create this directory and file.
$ unshellect
[0] Python 3
[1] Apt Upgrade
[2] Update Locate Database
[3] Edit this menu
[4] Temp Screen
[5] Shutdown
[6] Bash
[7] Exit
Make your selection [0-7]: 0
>>> quit()
$
$ unishellect -c '/path/to/my/alternate/config/bash.json'
[0] Edit this menu
[1] Bash Functions - NeoVim
[2] Bash Aliases - NeoVim
[3] Bash Profile - NeoVim
[4] Bash RC - NeoVim
[5] Bash PWD - NeoVim
[6] Bash Completions - NeoVim
[7] Bash Colors - NeoVim
[8] Exit
Make your selection [0-8]: 8
Exiting UniShellect
$
Ways you can help if you like.
You can fork this project, make your contributions, and make a pull-request.
If you like this project and care to donate to my PayPal:
Or Buy Me A Coffee if your prefer:
Name | Status |
---|---|
Latest Release | |
Latest Downloads | |
Total Downloads |
This score is with the exception of the json.h library which is not mine. It's large and could be done differently, but it's still a great library and I appreciate it and will still use it. I excluded it from the grade parsing as it is not my work anyway so I don't feel it reflects my actual work. The grade here reflects only code that I have personally written.
I tend to write the large majority of my own code libraries, but with this project I used a well known JSON C++ library for which I am grateful.
Credit goes to nlohmann/json @ GitHub
License Excerpt
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.