osl-incubator / makim

Make Improved
https://osl-incubator.github.io/makim/
BSD 3-Clause "New" or "Revised" License
8 stars 10 forks source link

WIP: change CLI backend to typer #78

Closed abhijeetSaroha closed 9 months ago

abhijeetSaroha commented 10 months ago

Created the new CLI file with typer named with makim_cli.py and change the __main__.py accordingly.

As issue completely solved, I will change the name to cli.py.

Solves #76

abhijeetSaroha commented 10 months ago

The one problem that I am currently facing is for --clean as it is used in only two run commands of .makim.yaml file. Could you please tell me more detail about this?

Because in previous cli.py file also there is no mention of --clean flag.

xmnlab commented 10 months ago

The one problem that I am currently facing is for --clean as it is used in only two run commands of .makim.yaml file. Could you please tell me more detail about this?

Because in previous cli.py file also there is no mention of --clean flag.

Makim is a tool for dynamic creating a CLI from specifications defined in .makim.yaml

--clean is not part of the built-in makim options, instead it is something defined for our .makim.yaml .. that config file is used for makim development only ... it is not something that would be used out side our development. Any other projects that use makim, can define their own set of group and targets.

xmnlab commented 10 months ago

thank you @abhijeetSaroha for working on that! I just added more comments here.

felipepaes commented 10 months ago

Hi @abhijeetSaroha, pleased to meet you!

I will be helping you with makim PRs since @xmnlab won't be able to test things on his computer for the next few days.

Please let me know if you need anything, whether it's for testing the PRs, exchanging/sharing ideas, or discussing opinions about the project.

I'm also on the Discord server. My timezone is GMT-3, but feel free to contact me at any time, ok?

felipepaes commented 10 months ago

I'm working on a feature (issue 30 ) for makim as well, so I will need to learn more about Typer. Currently I have added new options to the parser so that we could have something like this:

makim cron run backup
makim cron install backup
makim cron remove backup

Basically I have added a subcommand called cron which can add makim commands as cron jobs that are executed by the system via cron at specific set times.

Since we are going for Typer, I will be reading this piece of documentation about subcommands with Typer

Please let me know if you have any resources about Typer that you would recommend.

xmnlab commented 10 months ago

That looks nice, probably something that I would need to do for envers as well

abhijeetSaroha commented 10 months ago

Hi @abhijeetSaroha, pleased to meet you!

I will be helping you with makim PRs since @xmnlab won't be able to test things on his computer for the next few days.

Please let me know if you need anything, whether it's for testing the PRs, exchanging/sharing ideas, or discussing opinions about the project.

I'm also on the Discord server. My timezone is GMT-3, but feel free to contact me at any time, ok?

Pleased to meet you too @felipepaes sir.

abhijeetSaroha commented 10 months ago

@felipepaes I am not able to dynamically create command and create help text automatically. As @xmnlab , give example here.

Can you give some more idea about this?

felipepaes commented 10 months ago

@felipepaes I am not able to dynamically create command and create help text automatically. As @xmnlab , give example here.

Can you give some more idea about this?

Sorry @abhijeetSaroha I was at a retreat with family.

So, on that example he's getting the help from the targets defined in .makim.yaml, as an example he's already defining it as dictionary named targets.

Did you mean to generate the help text based on the .makim.yaml targets' args or the command help text?

felipepaes commented 10 months ago

Typer should automatically fetch the arguments and options when you use the --help option, but you can also pass a general cli help text when instantiating the Typer object.

app = typer.Typer(help="Awesome CLI user manager.")

source

xmnlab commented 10 months ago

@abhijeetSaroha could you share more about the error you have? is there your code already here on github? if so I can test it locally

xmnlab commented 9 months ago

superseded by #82