parser.add_argument("--version", action="version", version="%(prog)s @VERSION@")
# lists
- lists = subparsers.add_parser("lists", help=_("Show all lists"))
- lists.set_defaults(func=self.__lists)
+ list = subparsers.add_parser("list", help=_("Show all lists"))
+ list.set_defaults(func=self.__list)
- # list-create
- list_create = subparsers.add_parser("list-create", help=_("Create a new list"))
- list_create.add_argument("--name", required=True,
+ # create
+ create = subparsers.add_parser("create", help=_("Create a new list"))
+ create.add_argument("--name", required=True,
help=_("The name of the list"))
- list_create.add_argument("--created-by", required=True,
+ create.add_argument("--created-by", required=True,
default=os.environ.get("USER"), help=_("The creator of the list"))
- list_create.add_argument("--license", required=True,
+ create.add_argument("--license", required=True,
help=_("The license of the list"))
- list_create.set_defaults(func=self.__list_create)
+ create.set_defaults(func=self.__create)
- # list-show
- list_show = subparsers.add_parser("list-show", help=_("Shows details about a list"))
- list_show.add_argument("list", help=_("The name of the list"))
- list_show.set_defaults(func=self.__list_show)
+ # show
+ show = subparsers.add_parser("show", help=_("Shows details about a list"))
+ show.add_argument("list", help=_("The name of the list"))
+ show.set_defaults(func=self.__show)
- # list-update
- list_update = subparsers.add_parser("list-update", help=_("Updates a list"))
- list_update.add_argument("list", help=_("The name of the list"))
- list_update.set_defaults(func=self.__list_update)
+ # update
+ update = subparsers.add_parser("update", help=_("Updates a list"))
+ update.add_argument("list", help=_("The name of the list"))
+ update.set_defaults(func=self.__update)
- # list-export
- list_export = subparsers.add_parser("list-export", help=_("Exports a list"))
- list_export.add_argument("list", help=_("The name of the list"))
- list_export.set_defaults(func=self.__list_export)
+ # export
+ export = subparsers.add_parser("export", help=_("Exports a list"))
+ export.add_argument("list", help=_("The name of the list"))
+ export.set_defaults(func=self.__export)
- # list-add-source
- list_add_source = subparsers.add_parser("list-add-source",
+ # add-source
+ add_source = subparsers.add_parser("add-source",
help=_("Creates a new source to a list"))
- list_add_source.add_argument("list",
+ add_source.add_argument("list",
help=_("The name of the list"))
- list_add_source.add_argument("--name", required=True,
+ add_source.add_argument("--name", required=True,
help=_("The name of the source"))
- list_add_source.add_argument("--url", required=True,
+ add_source.add_argument("--url", required=True,
help=_("The URL of the source"))
- list_add_source.add_argument("--license", required=True,
+ add_source.add_argument("--license", required=True,
help=_("The license of the source"))
- list_add_source.add_argument("--created-by", required=True,
+ add_source.add_argument("--created-by", required=True,
default=os.environ.get("USER"), help=_("The creator of the source"))
- list_add_source.set_defaults(func=self.__list_add_source)
-
- # update
- update = subparsers.add_parser("update", help=_("Update sources"))
- update.set_defaults(func=self.__update)
+ add_source.set_defaults(func=self.__add_source)
# Parse all arguments
args = parser.parse_args()
# Otherwise just exit
sys.exit(0)
- def __lists(self, backend, args):
+ def __list(self, backend, args):
table = rich.table.Table(title=_("Lists"))
table.add_column(_("Name"))
table.add_column(_("Slug"))
# Print the table
self.console.print(table)
- def __list_create(self, backend, args):
+ def __create(self, backend, args):
"""
Creates a new list
"""
license = args.license,
)
- def __list_show(self, backend, args):
+ def __show(self, backend, args):
"""
Shows information about a list
"""
# Print the sources
self.console.print(table)
- def __list_update(self, backend, args):
+ def __update(self, backend, args):
"""
Updates a single list
"""
# Update!
list.update()
- def __list_export(self, backend, args):
+ def __export(self, backend, args):
"""
Exports a list
"""
# Export!
list.export(sys.stdout)
- def __list_add_source(self, backend, args):
+ def __add_source(self, backend, args):
"""
Adds a new source to a list
"""
license = args.license,
)
- def __update(self, backend, args):
- """
- Updates all sources
- """
- backend.update_sources()
-
def main():
c = CLI()