envio icon indicating copy to clipboard operation
envio copied to clipboard

"envio version" should not fail if shell is not known

Open agateau opened this issue 1 year ago • 2 comments

Describe the bug

I am creating a Clyde package for envio, but the package fails to build. This is because the package defines the command envio version as a test command for envio, but envio version fails with the following error message:

Creating config directory
Creating shellscript
Error: Could not get shell

After reading the code, I suspect this is because $SHELL is not defined on GitHub runners. In any case, a command to print the version should not need $SHELL to be set. It would also be a good practice if it did not write files to the user home directory.

To Reproduce Steps to reproduce the behavior:

  1. Start from a user who has never used envio (or rm -rf ~/.envio)
  2. Unset $SHELL
  3. Run envio version

Expected behavior

envio version should print the program version, ideally without creating any files.

Device (please complete the following information):

  • OS: Ubuntu 22.04
  • Shell: /bin/sh
  • CLI Version: 0.5.1

agateau avatar Apr 06 '24 11:04 agateau

Hey @agateau, thank you so much for you interest in creating a clyde pacakge for envio.

The problem here is that envio does need to create the config directory and get the user's shell to run certain operations successfully. So instead of running this check/action on the commands that need it individually, we just run it before running any command.

Hence when running the envio version command the problem arises.

One possible solution would be to perform these actions specifically for the commands that need it or just add a conditional block in the main function that checks to see the current command being run and based on that it decided whether or not it needs to perform these checks.

humblepenguinn avatar Apr 06 '24 17:04 humblepenguinn

One possible solution would be to perform these actions specifically for the commands that need it or just add a conditional block in the main function that checks to see the current command being run and based on that it decided whether or not it needs to perform these checks.

Sounds good!

agateau avatar Apr 07 '24 21:04 agateau