vulcano icon indicating copy to clipboard operation
vulcano copied to clipboard

Added rudimentary custom argument options

Open marnunez opened this issue 4 years ago • 4 comments

Nothing too fancy, can't register custom options for each argument, but it's workable. Do you deem it necessary to create a custom class for this? Perhaps enhancing the CommandCompleter would do.

marnunez avatar Mar 06 '20 13:03 marnunez

Codecov Report

Merging #119 into master will decrease coverage by 0.11%. The diff coverage is 97.61%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #119      +/-   ##
==========================================
- Coverage   99.37%   99.25%   -0.12%     
==========================================
  Files          17       17              
  Lines         794      808      +14     
==========================================
+ Hits          789      802      +13     
- Misses          5        6       +1
Impacted Files Coverage Δ
vulcano/command/classes.py 94.54% <100%> (ø) :arrow_up:
vulcano/command/completer.py 100% <100%> (ø) :arrow_up:
vulcano/command/models_test.py 97.5% <100%> (+0.06%) :arrow_up:
vulcano/command/models.py 96.42% <93.75%> (-1.3%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 7d728a1...c305397. Read the comment docs.

codecov[bot] avatar Mar 06 '20 13:03 codecov[bot]

Hi @marnunez, will take a look at the PR when possible. As far as I've seen, what you're introducing will break the completion of argument names and description if arg_opts is passed to the vulcano command. My purpose would be improving the command completer in order to be able to autocomplete also the value whenever the argument is configured in arg_opts (note that it should be a dictionary to be able to support multi arguments completion).

So for example, something like that:

@app.command('name', 'description here', arg_opts={'name': ['bob', 'rob']})
def set_user(name, age):
    # do something here

And on the completer, you'll prompt a list of completions only when the argument name is inside the arg_opts.

dgarana avatar Mar 07 '20 23:03 dgarana

Yeap, as soon as I pushed this I realised it wouldn't be enough. Besides, I soon ended up wishing for a completion that included the meta. I'll see what I can do

marnunez avatar Mar 09 '20 11:03 marnunez

Codacy Here is an overview of what got changed by this pull request:


Issues
======
+ Solved 4
- Added 9
           

Complexity increasing per file
==============================
- vulcano/command/models.py  2
- vulcano/command/completer.py  1
         

See the complete overview on Codacy

dgarana avatar Mar 09 '20 15:03 dgarana