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 . import main
|
||||||
from argparse import ArgumentParser
|
|
||||||
from subprocess import call
|
|
||||||
|
|
||||||
dir_path = path.join(path.dirname(path.realpath(__file__)), "commands")
|
if __name__ == "__main__":
|
||||||
commands = [x.replace(".sh", "") for x in listdir(dir_path)]
|
main()
|
||||||
|
|
||||||
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,6 +1,6 @@
|
|||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "guzzy"
|
name = "guzzy"
|
||||||
version = "0.1.0"
|
version = "0.1.1"
|
||||||
description = "Interactive CLI git client inside fzf."
|
description = "Interactive CLI git client inside fzf."
|
||||||
authors = ["samedamci <samedamci@disroot.org>"]
|
authors = ["samedamci <samedamci@disroot.org>"]
|
||||||
license = "ISC"
|
license = "ISC"
|
||||||
@ -23,7 +23,7 @@ include = ["LICENSE"]
|
|||||||
python = "^3.6"
|
python = "^3.6"
|
||||||
|
|
||||||
[tool.poetry.scripts]
|
[tool.poetry.scripts]
|
||||||
guzzy = "guzzy:__main__"
|
guzzy = "guzzy:main"
|
||||||
|
|
||||||
[build-system]
|
[build-system]
|
||||||
requires = ["poetry-core>=1.0.0"]
|
requires = ["poetry-core>=1.0.0"]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user