Move main code to __init__.py to avoid Traceback errors
This commit is contained in:
parent
85ba1b45ce
commit
1b5738b7e9
18
guzzy/__init__.py
Normal file
18
guzzy/__init__.py
Normal file
@ -0,0 +1,18 @@
|
||||
from os import listdir, path
|
||||
from argparse import ArgumentParser
|
||||
from subprocess import call
|
||||
|
||||
|
||||
def main():
|
||||
dir_path = path.join(path.dirname(path.realpath(__file__)), "commands")
|
||||
commands = [x.replace(".sh", "") for x in listdir(dir_path)]
|
||||
|
||||
parser = ArgumentParser(
|
||||
prog="guzzy",
|
||||
description="Interactive CLI git client inside fzf.",
|
||||
allow_abbrev=False,
|
||||
)
|
||||
parser.add_argument("command", choices=commands)
|
||||
args = parser.parse_args()
|
||||
|
||||
call(path.join(dir_path, f"{args.command}.sh"), shell=True)
|
@ -1,16 +1,4 @@
|
||||
from os import listdir, path
|
||||
from argparse import ArgumentParser
|
||||
from subprocess import call
|
||||
from . import main
|
||||
|
||||
dir_path = path.join(path.dirname(path.realpath(__file__)), "commands")
|
||||
commands = [x.replace(".sh", "") for x in listdir(dir_path)]
|
||||
|
||||
parser = ArgumentParser(
|
||||
prog="guzzy",
|
||||
description="Interactive CLI git client inside fzf.",
|
||||
allow_abbrev=False,
|
||||
)
|
||||
parser.add_argument("command", choices=commands)
|
||||
args = parser.parse_args()
|
||||
|
||||
call(path.join(dir_path, f"{args.command}.sh"), shell=True)
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
@ -1,6 +1,6 @@
|
||||
[tool.poetry]
|
||||
name = "guzzy"
|
||||
version = "0.1.0"
|
||||
version = "0.1.1"
|
||||
description = "Interactive CLI git client inside fzf."
|
||||
authors = ["samedamci <samedamci@disroot.org>"]
|
||||
license = "ISC"
|
||||
@ -23,7 +23,7 @@ include = ["LICENSE"]
|
||||
python = "^3.6"
|
||||
|
||||
[tool.poetry.scripts]
|
||||
guzzy = "guzzy:__main__"
|
||||
guzzy = "guzzy:main"
|
||||
|
||||
[build-system]
|
||||
requires = ["poetry-core>=1.0.0"]
|
||||
|
Loading…
x
Reference in New Issue
Block a user