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
{{ message }}
Repository navigation
CLI: "flask" command help doesn't list custom commands #1124
I am playing with the latest release of flask with cli module. I have created a command called initdb and when I call flask initdb it works as expected, but when I just call flask command it supposed to show the list of all available commands including initdb, which is not the case. Any idea why?
The flask command doesn't work for me. I don't know if I haven't set something up incorrectly, but trying to follow examples where the flask command is used do not work for me. I get the following: flask: command not found. Also, when trying to play with the minitwit example, and just trying python minitwit.py or python minitwit_tests.py I get the following error: @app.cli.command('initdb') AttributeError: 'Flask' object has no attribute 'cli'
I still cannot get the flask command to work, even after following post by @erwagasore . I haven't used Flask in a couple months, but my version is current. I am not sure if there needs to be a flask_config file or something else, but no shell I use recognizes this command.
This is just what I interpreted (apparently incorrectly) from the minitwit docs and link provided by @erwagasore above. I just realized, I don't have the version of flask with the cli.py module. So, I am guess it's my problem. Sorry for the confusion, but thanks for the help anyways.
changed the title [-]Calling "flask" command doesn't show my custom commands near "run" and "shell"[/-][+]"flask" command help doesn't list custom commands[/+]on Aug 28, 2014
I think I got a clue on this one. It seems indeed a problem with click. The envvar access is actually never executed:
# click.core.MultiCommand.parse_args
def parse_args(self, ctx, args):
if not args and self.no_args_is_help and not ctx.resilient_parsing:
echo(ctx.get_help())
ctx.exit()
return Command.parse_args(self, ctx, args)
This is the closest I've come to narrow the problem. If not args (flask) the function will exit on ctx.exit() but the problem is that env variables are actually accessed in Command.parse_args. That's why flask --help works correctly, because it has at least one arg and the environment gets set up.
I've also come that far. As a workaround we could set invoke_without_subcommand to true and print the help manually, but i think this should be fixed in click.
Activity
SherMM commentedon Jul 17, 2014
The flask command doesn't work for me. I don't know if I haven't set something up incorrectly, but trying to follow examples where the flask command is used do not work for me. I get the following:
flask: command not found. Also, when trying to play with the minitwit example, and just tryingpython minitwit.pyorpython minitwit_tests.pyI get the following error:@app.cli.command('initdb') AttributeError: 'Flask' object has no attribute 'cli'erwagasore commentedon Jul 17, 2014
I learned alot from the image tweeted by @mitsuhiko how this will help @SherMM http://i.imgur.com/hhuKBkv.png
SherMM commentedon Jul 17, 2014
I still cannot get the flask command to work, even after following post by @erwagasore . I haven't used Flask in a couple months, but my version is current. I am not sure if there needs to be a flask_config file or something else, but no shell I use recognizes this command.
untitaker commentedon Jul 17, 2014
There is no
flaskcommand. Where are you getting this information from?SherMM commentedon Jul 18, 2014
This is just what I interpreted (apparently incorrectly) from the minitwit docs and link provided by @erwagasore above. I just realized, I don't have the version of flask with the
cli.pymodule. So, I am guess it's my problem. Sorry for the confusion, but thanks for the help anyways.erwagasore commentedon Jul 18, 2014
The
cli.pymodule is in the latest flask commit on this repository. Check this out smurfix/flask-script#97 for more info on the future of flaskuntitaker commentedon Aug 28, 2014
Sorry for closing.
[-]Calling "flask" command doesn't show my custom commands near "run" and "shell"[/-][+]"flask" command help doesn't list custom commands[/+][-]"flask" command help doesn't list custom commands[/-][+]CLI: "flask" command help doesn't list custom commands[/+]untitaker commentedon Aug 28, 2014
Since
flask --helpworks correctly i suppose that this is a deficiency in click.pbu88 commentedon Aug 29, 2014
I think I got a clue on this one. It seems indeed a problem with
click. Theenvvaraccess is actually never executed:This is the closest I've come to narrow the problem. If not args (
flask) the function will exit onctx.exit()but the problem is that env variables are actually accessed inCommand.parse_args. That's whyflask --helpworks correctly, because it has at least one arg and the environment gets set up.untitaker commentedon Aug 29, 2014
I've also come that far. As a workaround we could set
invoke_without_subcommandto true and print the help manually, but i think this should be fixed in click.Show custom flask cli commands for "no arg" help
mitsuhiko commentedon May 26, 2016
I'm closing this for now as the latest changes implicitly fixed this.