1Metadata-Version: 1.1 2Name: knack 3Version: 0.8.2 4Summary: A Command-Line Interface framework 5Home-page: https://github.com/microsoft/knack 6Author: Microsoft Corporation 7Author-email: azpycli@microsoft.com 8License: MIT 9Description: Knack 10 ===== 11 12 .. image:: https://img.shields.io/pypi/v/knack.svg 13 :target: https://pypi.python.org/pypi/knack 14 15 .. image:: https://img.shields.io/pypi/pyversions/knack.svg 16 :target: https://pypi.python.org/pypi/knack 17 18 .. image:: https://dev.azure.com/azure-sdk/public/_apis/build/status/cli/microsoft.knack?branchName=dev 19 :target: https://dev.azure.com/azure-sdk/public/_build/latest?definitionId=1643&branchName=dev 20 21 22 ------------ 23 24 25 :: 26 27 _ _ 28 | | ___ __ __ _ ___| | __ 29 | |/ / '_ \ / _` |/ __| |/ / 30 | <| | | | (_| | (__| < 31 |_|\_\_| |_|\__,_|\___|_|\_\ 32 33 34 **A Command-Line Interface framework** 35 36 Installation is easy via pip: 37 38 .. code-block:: bash 39 40 pip install knack 41 42 Knack can be installed as a non-privileged user to your home directory by adding "--user" as below: 43 44 .. code-block:: bash 45 46 pip install knack --user 47 48 ------------ 49 50 .. note:: The project is in `initial development phase <https://semver.org/#how-should-i-deal-with-revisions-in-the-0yz-initial-development-phase>`__. We recommend pinning to at least a specific minor version when marking **knack** as a dependency in your project. 51 52 ------------ 53 54 55 Usage 56 ===== 57 58 59 .. code-block:: python 60 61 import sys 62 from collections import OrderedDict 63 64 from knack import CLI, ArgumentsContext, CLICommandsLoader 65 from knack.commands import CommandGroup 66 67 68 def abc_str(length=3): 69 import string 70 return string.ascii_lowercase[:length] 71 72 73 class MyCommandsLoader(CLICommandsLoader): 74 def load_command_table(self, args): 75 with CommandGroup(self, 'abc', '__main__#{}') as g: 76 g.command('str', 'abc_str') 77 return OrderedDict(self.command_table) 78 79 def load_arguments(self, command): 80 with ArgumentsContext(self, 'abc str') as ac: 81 ac.argument('length', type=int) 82 super(MyCommandsLoader, self).load_arguments(command) 83 84 85 mycli = CLI(cli_name='mycli', commands_loader_cls=MyCommandsLoader) 86 exit_code = mycli.invoke(sys.argv[1:]) 87 sys.exit(exit_code) 88 89 # $ python mycli.py abc str 90 # "abc" 91 92 # $ python mycli.py abc str --length 5 93 # "abcde" 94 95 # $ python mycli.py abc str --length 100 96 # "abcdefghijklmnopqrstuvwxyz" 97 98 99 More samples and snippets are available at `examples <https://github.com/Microsoft/knack/tree/dev/examples>`__. 100 101 102 Documentation 103 ============= 104 105 Documentation is available at `docs <https://github.com/Microsoft/knack/tree/dev/docs>`__. 106 107 Developer Setup 108 =============== 109 110 In a virtual environment, install the `requirements.txt` file. 111 112 .. code-block:: bash 113 114 pip install -r requirements.txt 115 pip install -e . 116 117 Run Automation 118 ============== 119 120 This project supports running automation using `tox <https://tox.readthedocs.io/en/latest/>`__. 121 122 .. code-block:: bash 123 124 pip install tox 125 tox 126 127 128 Real-world uses 129 =============== 130 131 - `Azure CLI <https://github.com/Azure/azure-cli/>`__: The Azure CLI 2.0 is Azure's new command line experience for managing Azure resources. 132 - `VSTS CLI <https://github.com/Microsoft/vsts-cli>`__: A command-line interface for Visual Studio Team Services (VSTS) and Team Foundation Server (TFS). With the VSTS CLI, you can manage and work with resources including pull requests, work items, builds, and more. 133 - `Service Fabric CLI <https://github.com/Azure/service-fabric-cli>`__: A command-line interface for interacting with Azure Service Fabric clusters and their related entities. 134 135 Do you use knack in your CLI as well? Open a pull request to include it here. We would love to have it in our list. 136 137 138 Release History 139 =============== 140 141 See `GitHub Releases <https://github.com/Microsoft/knack/releases>`__. 142 143 144 Contribute Code 145 =============== 146 147 This project has adopted the `Microsoft Open Source Code of Conduct <https://opensource.microsoft.com/codeofconduct/>`__. 148 149 For more information see the `Code of Conduct FAQ <https://opensource.microsoft.com/codeofconduct/faq/>`__ or contact `opencode@microsoft.com <mailto:opencode@microsoft.com>`__ with any additional questions or comments. 150 151 If you would like to become an active contributor to this project, please 152 follow the instructions provided in `Contribution License Agreement <https://cla.microsoft.com/>`__. 153 154 155 License 156 ======= 157 158 Knack is licensed under `MIT <LICENSE>`__. 159 160Platform: UNKNOWN 161Classifier: Development Status :: 4 - Beta 162Classifier: Intended Audience :: Developers 163Classifier: Intended Audience :: System Administrators 164Classifier: Programming Language :: Python 165Classifier: Programming Language :: Python :: 3 166Classifier: Programming Language :: Python :: 3.6 167Classifier: Programming Language :: Python :: 3.7 168Classifier: Programming Language :: Python :: 3.8 169Classifier: Programming Language :: Python :: 3.9 170Classifier: License :: OSI Approved :: MIT License 171