当前位置: 首页>>代码示例>>Python>>正文


Python arguments.usage函数代码示例

本文整理汇总了Python中slpkg.arguments.usage函数的典型用法代码示例。如果您正苦于以下问题:Python usage函数的具体用法?Python usage怎么用?Python usage使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了usage函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: command_repo_add

 def command_repo_add(self):
     """Add custom repositories
     """
     if len(self.args) == 3 and self.args[0] == "repo-add":
         Repo().add(self.args[1], self.args[2])
     else:
         usage("")
开发者ID:websafe,项目名称:slpkg,代码行数:7,代码来源:main.py

示例2: pkg_install

 def pkg_install(self):
     """Install packages by repository
     """
     flag = []
     options = [
         "-s",
         "--sync"
     ]
     additional_options = [
         "--resolve-off",
         "--case-ins"
     ]
     for arg in self.args:
         if arg in additional_options:
             flag.append(arg)
     if len(self.args) >= 3 and self.args[0] in options:
         if (self.args[1] in self.meta.repositories and
                 self.args[1] not in ["sbo"]):
             BinaryInstall(self.args[2:], self.args[1], flag).start(
                 if_upgrade=False)
         elif (self.args[1] == "sbo" and
                 self.args[1] in self.meta.repositories):
             SBoInstall(self.args[2:], flag).start(if_upgrade=False)
         else:
             usage(self.args[1])
     else:
         usage("")
开发者ID:websafe,项目名称:slpkg,代码行数:27,代码来源:main.py

示例3: command_repo_remove

 def command_repo_remove(self):
     """Remove custom repositories
     """
     if len(self.args) == 2 and self.args[0] == "repo-remove":
         Repo().remove(self.args[1])
     else:
         usage("")
开发者ID:websafe,项目名称:slpkg,代码行数:7,代码来源:main.py

示例4: command_repo_enable

 def command_repo_enable(self):
     """Repositories enable/disable
     """
     if len(self.args) == 1 and self.args[0] == "repo-enable":
         RepoEnable().choose()
     else:
         usage("")
开发者ID:websafe,项目名称:slpkg,代码行数:7,代码来源:main.py

示例5: command_repo_list

 def command_repo_list(self):
     """Repositories list
     """
     if len(self.args) == 1 and self.args[0] == "repo-list":
         RepoList().repos()
     else:
         usage("")
开发者ID:websafe,项目名称:slpkg,代码行数:7,代码来源:main.py

示例6: pkg_tracking

 def pkg_tracking(self):
     """Tracking package dependencies
     """
     flag = []
     options = [
         "-t",
         "--tracking"
     ]
     additional_options = [
         "--check-deps",
         "--graph="
     ]
     if (len(self.args) >= 3 and len(self.args) < 6 and
             self.args[0] in options):
         if self.args[1] in self.meta.repositories:
             for arg in self.args[3:]:
                 if arg.startswith(additional_options[1]):
                     flag.append(arg)
                 if arg in additional_options:
                     flag.append(arg)
             TrackingDeps(self.args[2], self.args[1], flag).run()
         else:
             usage(self.args[1])
     else:
         usage("")
开发者ID:websafe,项目名称:slpkg,代码行数:25,代码来源:main.py

示例7: command_update_slpkg

 def command_update_slpkg(self):
     """Slpkg it self update
     """
     if len(self.args) == 2 and self.args[0] == "update-slpkg":
         it_self_update()
     else:
         usage("")
开发者ID:websafe,项目名称:slpkg,代码行数:7,代码来源:main.py

示例8: pkg_blacklist

 def pkg_blacklist(self):
     """Manage blacklist packages
     """
     blacklist = BlackList()
     options = [
         "-b",
         "--blacklist"
     ]
     flag = [
         "--add",
         "--remove"
     ]
     command = ["list"]
     if (len(self.args) == 2 and self.args[0] in options and
             self.args[1] == command[0]):
         blacklist.listed()
     elif (len(self.args) > 2 and self.args[0] in options and
             self.args[-1] == flag[0]):
         blacklist.add(self.args[1:-1])
     elif (len(self.args) == 3 and self.args[0] in options and
             self.args[1] == "ALL" and self.args[-1] == flag[1]):
         blacklist.remove(blacklist.get_black())
     elif (len(self.args) > 2 and self.args[0] in options and
             self.args[-1] == flag[1]):
         blacklist.remove(self.args[1:-1])
     else:
         usage("")
开发者ID:websafe,项目名称:slpkg,代码行数:27,代码来源:main.py

示例9: bin_install

 def bin_install(self):
     """Install Slackware binary packages
     """
     packages = self.args[1:]
     options = [
         "-i",
         "--installpkg"
     ]
     flag = ""
     flags = [
         "--warn",
         "--md5sum",
         "--root",
         "--infobox",
         "--menu",
         "--terse",
         "--ask",
         "--priority",
         "--tagfile"
     ]
     if len(self.args) > 1 and self.args[0] in options:
         if self.args[1] in flags:
             flag = self.args[1]
             packages = self.args[2:]
         PackageManager(packages).install(flag)
     else:
         usage("")
开发者ID:websafe,项目名称:slpkg,代码行数:27,代码来源:main.py

示例10: bin_remove

 def bin_remove(self):
     """Remove Slackware packages
     """
     packages = self.args[1:]
     options = [
         "-r",
         "--removepkg"
     ]
     additional_options = [
         "--deps",
         "--check-deps",
         "--tag",
         "--checklist"
     ]
     flag, extra = "", []
     flags = [
         "-warn",
         "-preserve",
         "-copy",
         "-keep"
     ]
     if len(self.args) > 1 and self.args[0] in options:
         for additional in additional_options:
             if additional in self.args:
                 extra.append(additional)
                 self.args.remove(additional)
             packages = self.args[1:]
         if self.args[1] in flags:
             flag = self.args[1]
             packages = self.args[2:]
         PackageManager(packages).remove(flag, extra)
     else:
         usage("")
开发者ID:websafe,项目名称:slpkg,代码行数:33,代码来源:main.py

示例11: command_new_config

 def command_new_config(self):
     """Manage .new configuration files
     """
     if len(self.args) == 1 and self.args[0] == "new-config":
         NewConfig().run()
     else:
         usage("")
开发者ID:websafe,项目名称:slpkg,代码行数:7,代码来源:main.py

示例12: command_health

 def command_health(self):
     """Check package health
     """
     if len(self.args) == 1 and self.args[0] == "health":
         PackageHealth(mode="").test()
     elif (len(self.args) == 2 and self.args[0] == "health" and
             self.args[1] == "--silent"):
         PackageHealth(mode=self.args[1]).test()
     else:
         usage("")
开发者ID:websafe,项目名称:slpkg,代码行数:10,代码来源:main.py

示例13: command_upgrade

 def command_upgrade(self):
     """Recreate repositories package lists
     """
     if len(self.args) == 1 and self.args[0] == "upgrade":
         Initialization(False).upgrade(only="")
     elif (len(self.args) == 2 and self.args[0] == "upgrade" and
             self.args[1].startswith("--only=")):
         repos = self.args[1].split("=")[-1].split(",")
         Initialization(False).upgrade(repos)
     else:
         usage("")
开发者ID:websafe,项目名称:slpkg,代码行数:11,代码来源:main.py

示例14: help_version

 def help_version(self):
     """Help and version info
     """
     if (len(self.args) == 1 and self.args[0] in ["-h", "--help"] and
             self.args[1:] == []):
         options()
     elif (len(self.args) == 1 and self.args[0] in ["-v", "--version"] and
             self.args[1:] == []):
         prog_version()
     else:
         usage("")
开发者ID:websafe,项目名称:slpkg,代码行数:11,代码来源:main.py

示例15: auto_build

 def auto_build(self):
     """Auto built tool
     """
     options = [
         "-a",
         "--autobuild"
     ]
     if len(self.args) >= 3 and self.args[0] in options:
         AutoBuild(self.args[1], self.args[2:], self.meta.path).run()
     else:
         usage("")
开发者ID:websafe,项目名称:slpkg,代码行数:11,代码来源:main.py


注:本文中的slpkg.arguments.usage函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。