Skip to content

Commit

Permalink
Added option --location
Browse files Browse the repository at this point in the history
  • Loading branch information
pchakraborty committed Oct 3, 2024
1 parent ae51946 commit f6f71f1
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/mepo/cmdline/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,19 @@ def get_version():
return metadata.version("mepo")


class LocationAction(argparse._StoreTrueAction):

def __init__(self, option_strings, dest, const=True, help=None):
super().__init__(option_strings, dest, const, help=help)

def __call__(self, parser, namespace, values, option_string=None):
import os, sys
import mepo

print(os.path.dirname(mepo.__file__))
sys.exit(0)


class MepoArgParser:

__slots__ = ["parser", "subparsers"]
Expand All @@ -23,6 +36,9 @@ def __init__(self):
description="Tool to manage (m)ultiple r(epo)s"
)
self.parser.add_argument("--version", action="version", version=get_version())
self.parser.add_argument(
"--location", action=LocationAction, help=argparse.SUPPRESS
)
self.subparsers = self.parser.add_subparsers()
self.subparsers.title = "mepo commands"
self.subparsers.required = True
Expand Down

0 comments on commit f6f71f1

Please sign in to comment.