Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cli: improved 'Set' validator supports csv and non-string types #452

Merged
merged 1 commit into from
Jun 28, 2019

Conversation

koreno
Copy link
Collaborator

@koreno koreno commented Jun 26, 2019

No description provided.

@koreno koreno requested a review from henryiii June 26, 2019 21:31
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.2%) to 82.36% when pulling df5b5fd on multi-type-set-cli-switch into 0d49594 on master.

@henryiii henryiii merged commit 6109be6 into master Jun 28, 2019
@henryiii henryiii deleted the multi-type-set-cli-switch branch June 28, 2019 14:00
@jjlorenzo
Copy link

I get this error if I use master, I think is related to this change

Usage:
    tlawr-to-boot [SWITCHES] name

Traceback (most recent call last):
  File "/Users/jjlorenzo/Desktop/hackintosh/tlawr/.venv/src/plumbum/plumbum/cli/application.py", line 553, in run
    ordered, tailargs = inst._validate_args(swfuncs, tailargs)
  File "/Users/jjlorenzo/Desktop/hackintosh/tlawr/.venv/src/plumbum/plumbum/cli/application.py", line 432, in _validate_args
    raise ShowHelp()
plumbum.cli.application.ShowHelp

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/jjlorenzo/Desktop/hackintosh/tlawr/.venv/bin/tlawr-to-boot", line 11, in <module>
    load_entry_point('tlawr', 'console_scripts', 'tlawr-to-boot')()
  File "/Users/jjlorenzo/Desktop/hackintosh/tlawr/.venv/src/plumbum/plumbum/cli/application.py", line 555, in run
    inst.help()
  File "/Users/jjlorenzo/Desktop/hackintosh/tlawr/.venv/src/plumbum/plumbum/cli/application.py", line 865, in help
    len(prefix) for si, prefix, color in switchs(by_groups, False)) + 4
  File "/Users/jjlorenzo/Desktop/hackintosh/tlawr/.venv/src/plumbum/plumbum/cli/application.py", line 865, in <genexpr>
    len(prefix) for si, prefix, color in switchs(by_groups, False)) + 4
  File "/Users/jjlorenzo/Desktop/hackintosh/tlawr/.venv/src/plumbum/plumbum/cli/application.py", line 853, in switchs
    typename = str(si.argtype)
  File "/Users/jjlorenzo/Desktop/hackintosh/tlawr/.venv/src/plumbum/plumbum/cli/switches.py", line 471, in __repr__
    v if isinstance(v, str) else v.__name__ for v in self.values.values()))
AttributeError: 'tuple' object has no attribute 'values'

with something as simpler as

echoes = cli.SwitchAttr("echo", cli.Set("registry"), list=True, help="echoes")

@henryiii
Copy link
Collaborator

This is a blocker for #445. We need a test for this plus the new behavior (this was added without tests! :( )

@henryiii
Copy link
Collaborator

(PS: It would be better to open an issue then refer to this PR, rather than comment on an old PR)

@koreno
Copy link
Collaborator Author

koreno commented Sep 18, 2019 via email

@koreno koreno mentioned this pull request Sep 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants