Jaymon / captain

command line python scripts for humans
MIT License
13 stars 1 forks source link

main() and main_sub() don't work #55

Closed Jaymon closed 4 years ago

Jaymon commented 4 years ago

this doesn't work:

from captain import exit

def main():
    print("main")

def main_foo():
    print("main foo")

if __name__ == "__main__":
    exit(__name__)

I should be able to do:

$ python -m modname
main

$ python -m modname foo
main foo
Jaymon commented 4 years ago

I just got bit by this again in a project, I really need to support this