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

default_command fails with command with modifiers #348

Open
ign1s-fatuus opened this issue Dec 12, 2018 · 4 comments · May be fixed by #384
Open

default_command fails with command with modifiers #348

ign1s-fatuus opened this issue Dec 12, 2018 · 4 comments · May be fixed by #384

Comments

@ign1s-fatuus
Copy link

ign1s-fatuus commented Dec 12, 2018

I am setting up my config file and want to make it so that the default execution of todo is this:
todo list --no-reverse --sort categories

When I add it to the config file via: default_command = list --no-reverse --sort categories I get the following errors:

Traceback (most recent call last):
  File "/usr/bin/todo", line 5, in <module>
    cli()
  File "/usr/lib/python3.7/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python3.7/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3.7/site-packages/click/core.py", line 1114, in invoke
    return Command.invoke(self, ctx)
  File "/usr/lib/python3.7/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python3.7/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/usr/lib/python3.7/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/usr/lib/python3.7/site-packages/todoman/cli.py", line 34, in wrapper
    return f(*a, **kw)
  File "/usr/lib/python3.7/site-packages/todoman/cli.py", line 314, in cli
    ctx.config['main']['default_command'],
  File "/usr/lib/python3.7/site-packages/todoman/cli.py", line 324, in invoke_command
    click_ctx.invoke(cli.commands[command], args)

I have tried putting it is quotes, as in "default_command = list --no-reverse --sort categories" but it returns the same error message. When I just change it todefault_command = list everything seems to work just fine.

Is it possible to change the default_command variable to include "list" with modifiers?

@WhyNotHugo
Copy link
Member

There's no support for this so far, but it might be pretty simple to implement.

@ign1s-fatuus
Copy link
Author

Would be super useful as its a pain tying todo list --status ANY --sort categories --no-reverse every time I want to get a good look at my four managed todo lists. As of right now I am working on setting up a key binding for my xmonad installs that will just run the command and pipe the output to a dialog window, such as dunst, to make things easy. But now I'm spring-boarding away from the problem at hand.

@alexdavid
Copy link

I'd be happy to implement this since I would also like this feature, but wanted to discuss implementation before submitting a PR.

I think ideally default_command should accept either an array or string, and if it's an array use those as argv, otherwise assume a single argument. Otherwise we'd have to implement our own argument parsing (would need to deal with parsing quotes, etc)

Is that in alignment of what you were thinking @WhyNotHugo?

alexdavid pushed a commit to alexdavid/dotfiles that referenced this issue Jan 25, 2020
Eventually this should go in todoman config as `default_command`
pimutils/todoman#348
@WhyNotHugo
Copy link
Member

Yes, that sounds good to me.

@alexdavid alexdavid linked a pull request Apr 18, 2020 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants