You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@mathisschmidt Correct, same issue. I'm still trying to work something out. As your comment implies, you could use only options (i.e. no arguments) if that would fit your interface design.
After combing through the code, I did find another attribute that might help in the Application class: self._single_command. There is some logic that uses it to determine what should happen when you run the program. With my initial testing, I got an Index out of range error. That was just my first try, though. Haven't really dug any deeper yet.
Activity
b0g3r commentedon Nov 2, 2019
The same on cleo
0.7.6vikpe commentedon Nov 16, 2019
Commit 132ad3e (2018-12-06) removed
set_default_command().In versions
<=0.6.8Use
set_default_command().In versions
>0.6.8Problem
.default().help()command is added first (as part of the default config) and is thus always run as the default command.Solution
Create a custom config where the help command is not set as default and pass it to your application, example:
config.pymain.pyThis is what I could think of until there is a public method available that allows you to define the default command.
Ruin2121 commentedon Jun 20, 2024
I know this is a bit old, but it's pretty simple to do it. I don't know if it is intended for you to override
self._default_command, but it works.ironbars commentedon Jan 5, 2025
@Ruin2121 When I set
self._default_command, I get the following error (keeping with the greet example). Any idea what the issue might be?But...
Oddly enough though, the help works.
Edit: Forgot to mention that I'm setting
_default_commandlike this in my main:I've seen it done this way elsewhere and I don't see a functional difference.
mathisschmidt commentedon Jan 13, 2025
I have problem for create the default command too. It look like if you have argument, the technic of Ruin2121 is not working. It is same for you?
ironbars commentedon Jan 13, 2025
@mathisschmidt Correct, same issue. I'm still trying to work something out. As your comment implies, you could use only options (i.e. no arguments) if that would fit your interface design.
After combing through the code, I did find another attribute that might help in the Application class:
self._single_command. There is some logic that uses it to determine what should happen when you run the program. With my initial testing, I got an Index out of range error. That was just my first try, though. Haven't really dug any deeper yet.mathisschmidt commentedon Jan 13, 2025
@ironbars I did same, see the error and stop. If I find something before a release give this feature, I will send you a message here.
ironbars commentedon Jan 14, 2025
@mathisschmidt Thanks, I'll do the same.