eth-cscs / pyfirecrest

Python wrappers for the FirecREST API

Home Page:https://pyfirecrest.readthedocs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CLI: Allow machine name to be loaded as an environmental variable

chrisjsewell opened this issue Β· comments

Thanks for the CLI, looks good πŸ‘Œ
I hadn't heard of typer before, but I see that its built on-top of click, which I used in #32 (https://typer.tiangolo.com/tutorial/using-click/)

I think it would be nice if you could also set the machine name as an environmental variable, similar to FIRECREST_URL etc, as it's a pain to have to type it for every command.

I note that with the machine name and the client, it would probably be better to "pass" it from main to the commands, using a context, rather than using a global variable: https://typer.tiangolo.com/tutorial/commands/context/
this is what I did in #32

Also, it might be nice to read the variables from a YAML/TOML file, as an alternative to environmental variables

Finally, for #35 @ekouts, you might want to consider using sphinx-click: tiangolo/typer#200 (comment)

Also, for commands like firecrest mkdir, it might be nice to print some message, to indicate that the command was successful.

commented

We are having a look to this issue, but with machine being an argument, we haven't found a nice way of implementing it. With ls, for instance, machine is passed before path, and we are seeing that even if the value is obtained from an environment variable, the command still fails because only one argument was passed. It still needs path. If machine would have been the last argument, it would probably have worked. Maybe a solution could be in a later version to make machine a cli option instead of an argument like in the PR you mention.

The new features that are proposed in the issue are added in #67 and #70.