fabric / fabric

Simple, Pythonic remote execution and deployment.
http://fabfile.org
BSD 2-Clause "Simplified" License
14.87k stars 1.94k forks source link

Tasks with underscores in names don't work #2059

Open lucadealfaro opened 4 years ago

lucadealfaro commented 4 years ago
@task
def is_working(c):
    print("Yes, it works")
$ fab is_working
No idea what 'is_working' is!
miso-belica commented 4 years ago

Hi, you need to use fab is-working. Fabric translates the naming convention from Python to CLI for you 😉 I think it is possible to turn off. It's somewhere in the documentation if you really insist on underscores.

lucadealfaro commented 4 years ago

Great, thanks! I did not know that. No problem, I just wish it also changed all the "t" into "p" and vice versa, it would make just as much sense, and I would get to write "pup-file" instead of "put_file", which is clearly more fun... ;-)

miso-belica commented 4 years ago

@lucadealfaro You can read more in the documentation http://docs.pyinvoke.org/en/stable/concepts/namespaces.html#dashes-vs-underscores

PhiOfX commented 1 year ago

It is not great practice to modify user choices by default without at least some warning. Dashes and underscores are visually close and people may spend hours pulling their hair (I did) of why something doesn't work (especially with the migration for fabric 2). I would recommend either auto_dash_names: false by default, or if the CLI dash convention is so important to print some warning on screen when processing a task with underscores.

somnath-binary commented 2 months ago

It only took me a full day, a few clumps of hair, and most of my patience. On the bright side, I’m saving on haircuts for the next few weeks!