procServ
procServ copied to clipboard
procServUtils autocomplete and new commands
Hello, this PR adds some functionalities to the procServUtils scripts:
- Bash autocomplete through
argcomplete
- New commands to restart, rename or open logs of the processes
- Print
status
as a table with color support, to be easier to read - Fix some unhandled exceptions
- Documentation for the commands
To enable these functionalities three python dependencies are needed: argcomplete
, tabulate
and termcolor
. Unfortunately the current installation process does not support installing dependencies so one has to install them manually through pip.
Do you think the installation process can be modified to use pip to automatically handle dependencies?
All the changes here are compatible with existing configuration files and do not break compatibility (hopefully).
@mdavidsaver and @mark0n, do you have opinions on this? Looks good to me. Are the additional Python packages (argcomplete, termcolor, tabulate) appropriate and reasonable?
My first benchmark for dependencies is presence in the Debian package repository. All three have been present since at least Debian 8 (10 is stable atm). argcomplete tabulate termcolor
argcomplete and tabulate appear at a glance to be healthy projects with recent releases and links to VCS repos.
termcolor appears to be defunct, with no release since 2011, and no authoritative VCS repository listed.
Personally, I would make this three optional dependencies with some try: ... import
. As used, termcolor and argcomplete can be trivially stubbed out, with tabulate being only slightly more involved.
Hello @mdavidsaver, thanks for your comments. I will try to address all of them in the following days.
I made the three packages optional, adding some fallback functions that emulate almost the same behavior as before this PR.
Then I fixed the systemctl
calls order and reverted the check_call
on systemctl disable
. I also added a test function for the rename
command and updated the readme.
I redirected the standard error of the systemctl reset-failed
command to /dev/null
because this fails when there is nothing to reset (which is the most common situation).
I didn't remove the install_requires
comment, as this will be useful when the project will move to setuptools
. For the moment I did not implement this change.
Lastly, since the rename
command causes the service to stop, I added a dialog for the user to confirm the operation, and I added a notice to the readme.