1*61c4878aSAndroid Build Coastguard Worker.. _module-pw_cli: 2*61c4878aSAndroid Build Coastguard Worker 3*61c4878aSAndroid Build Coastguard Worker====== 4*61c4878aSAndroid Build Coastguard Workerpw_cli 5*61c4878aSAndroid Build Coastguard Worker====== 6*61c4878aSAndroid Build Coastguard Worker.. pigweed-module:: 7*61c4878aSAndroid Build Coastguard Worker :name: pw_cli 8*61c4878aSAndroid Build Coastguard Worker 9*61c4878aSAndroid Build Coastguard Worker - **Add some flair**: Build out consistent experiences with building blocks 10*61c4878aSAndroid Build Coastguard Worker for command-line utilities. 11*61c4878aSAndroid Build Coastguard Worker - **Accelerate workflows**: Create custom ``pw`` commands to streamline 12*61c4878aSAndroid Build Coastguard Worker common developer workflows. 13*61c4878aSAndroid Build Coastguard Worker 14*61c4878aSAndroid Build Coastguard Worker.. pw_cli-nav-start 15*61c4878aSAndroid Build Coastguard Worker 16*61c4878aSAndroid Build Coastguard Worker.. grid:: 1 17*61c4878aSAndroid Build Coastguard Worker 18*61c4878aSAndroid Build Coastguard Worker .. grid-item-card:: :octicon:`code-square` API reference 19*61c4878aSAndroid Build Coastguard Worker :link: module-pw_cli-api 20*61c4878aSAndroid Build Coastguard Worker :link-type: ref 21*61c4878aSAndroid Build Coastguard Worker :class-item: sales-pitch-cta-primary 22*61c4878aSAndroid Build Coastguard Worker 23*61c4878aSAndroid Build Coastguard Worker Reference details about the ``pw_cli`` Python API 24*61c4878aSAndroid Build Coastguard Worker 25*61c4878aSAndroid Build Coastguard Worker.. pw_cli-nav-end 26*61c4878aSAndroid Build Coastguard Worker 27*61c4878aSAndroid Build Coastguard WorkerThis directory contains the ``pw`` command line interface (CLI) that facilitates 28*61c4878aSAndroid Build Coastguard Workerworking with Pigweed. The CLI module adds several subcommands prefixed with 29*61c4878aSAndroid Build Coastguard Worker``pw``, and provides a mechanism for other Pigweed modules to behave as 30*61c4878aSAndroid Build Coastguard Worker"plugins" and register themselves as ``pw`` commands as well. After activating 31*61c4878aSAndroid Build Coastguard Workerthe Pigweed environment, these commands will be available for use. 32*61c4878aSAndroid Build Coastguard Worker 33*61c4878aSAndroid Build Coastguard Worker``pw`` includes the following commands by default: 34*61c4878aSAndroid Build Coastguard Worker 35*61c4878aSAndroid Build Coastguard Worker.. code-block:: text 36*61c4878aSAndroid Build Coastguard Worker 37*61c4878aSAndroid Build Coastguard Worker doctor Check that the environment is set up correctly for Pigweed. 38*61c4878aSAndroid Build Coastguard Worker format Check and fix formatting for source files. 39*61c4878aSAndroid Build Coastguard Worker help Display detailed information about pw commands. 40*61c4878aSAndroid Build Coastguard Worker ide Configure editors and IDEs to work best with Pigweed. 41*61c4878aSAndroid Build Coastguard Worker logdemo Show how logs look at various levels. 42*61c4878aSAndroid Build Coastguard Worker module Utilities for managing modules. 43*61c4878aSAndroid Build Coastguard Worker test Run Pigweed unit tests built using GN. 44*61c4878aSAndroid Build Coastguard Worker watch Watch files for changes and rebuild. 45*61c4878aSAndroid Build Coastguard Worker 46*61c4878aSAndroid Build Coastguard WorkerTo see an up-to-date list of ``pw`` subcommands, run ``pw --help``. 47*61c4878aSAndroid Build Coastguard Worker 48*61c4878aSAndroid Build Coastguard Worker---------------- 49*61c4878aSAndroid Build Coastguard WorkerInvoking ``pw`` 50*61c4878aSAndroid Build Coastguard Worker---------------- 51*61c4878aSAndroid Build Coastguard Worker``pw`` subcommands are invoked by providing the command name. Arguments prior to 52*61c4878aSAndroid Build Coastguard Workerthe command are interpreted by ``pw`` itself; all arguments after the command 53*61c4878aSAndroid Build Coastguard Workername are interpreted by the command. 54*61c4878aSAndroid Build Coastguard Worker 55*61c4878aSAndroid Build Coastguard WorkerHere are some example invocations of ``pw``: 56*61c4878aSAndroid Build Coastguard Worker 57*61c4878aSAndroid Build Coastguard Worker.. code-block:: text 58*61c4878aSAndroid Build Coastguard Worker 59*61c4878aSAndroid Build Coastguard Worker # Run the doctor command 60*61c4878aSAndroid Build Coastguard Worker $ pw doctor 61*61c4878aSAndroid Build Coastguard Worker 62*61c4878aSAndroid Build Coastguard Worker # Run format --fix with debug-level logs 63*61c4878aSAndroid Build Coastguard Worker $ pw --loglevel debug format --fix 64*61c4878aSAndroid Build Coastguard Worker 65*61c4878aSAndroid Build Coastguard Worker # Display help for the pw command 66*61c4878aSAndroid Build Coastguard Worker $ pw -h watch 67*61c4878aSAndroid Build Coastguard Worker 68*61c4878aSAndroid Build Coastguard Worker # Display help for the watch command 69*61c4878aSAndroid Build Coastguard Worker $ pw watch -h 70*61c4878aSAndroid Build Coastguard Worker 71*61c4878aSAndroid Build Coastguard Worker-------------------------- 72*61c4878aSAndroid Build Coastguard WorkerRegistering ``pw`` plugins 73*61c4878aSAndroid Build Coastguard Worker-------------------------- 74*61c4878aSAndroid Build Coastguard WorkerProjects can register their own Python scripts as ``pw`` commands. ``pw`` 75*61c4878aSAndroid Build Coastguard Workerplugins are registered by providing the command name, module, and function in 76*61c4878aSAndroid Build Coastguard Workerthe ``pigweed.json`` file. ``pigweed.json`` files can add new commands or 77*61c4878aSAndroid Build Coastguard Workeroverride built-in commands. Since they are accessed by module name, plugins must 78*61c4878aSAndroid Build Coastguard Workerbe defined in Python packages that are installed in the Pigweed virtual 79*61c4878aSAndroid Build Coastguard Workerenvironment. 80*61c4878aSAndroid Build Coastguard Worker 81*61c4878aSAndroid Build Coastguard Workerpigweed.json file format 82*61c4878aSAndroid Build Coastguard Worker======================== 83*61c4878aSAndroid Build Coastguard Worker``pigweed.json`` contains plugin entries in the following format: 84*61c4878aSAndroid Build Coastguard Worker 85*61c4878aSAndroid Build Coastguard Worker.. code-block:: 86*61c4878aSAndroid Build Coastguard Worker 87*61c4878aSAndroid Build Coastguard Worker { 88*61c4878aSAndroid Build Coastguard Worker "pw": { 89*61c4878aSAndroid Build Coastguard Worker "pw_cli": { 90*61c4878aSAndroid Build Coastguard Worker "plugins": { 91*61c4878aSAndroid Build Coastguard Worker "<plugin name>": { 92*61c4878aSAndroid Build Coastguard Worker "module": "<module containing plugin>", 93*61c4878aSAndroid Build Coastguard Worker "function": "<entry point for plugin>" 94*61c4878aSAndroid Build Coastguard Worker }, 95*61c4878aSAndroid Build Coastguard Worker ... 96*61c4878aSAndroid Build Coastguard Worker } 97*61c4878aSAndroid Build Coastguard Worker } 98*61c4878aSAndroid Build Coastguard Worker } 99*61c4878aSAndroid Build Coastguard Worker } 100*61c4878aSAndroid Build Coastguard Worker 101*61c4878aSAndroid Build Coastguard WorkerThe following example registers three commands: 102*61c4878aSAndroid Build Coastguard Worker 103*61c4878aSAndroid Build Coastguard Worker.. code-block:: 104*61c4878aSAndroid Build Coastguard Worker 105*61c4878aSAndroid Build Coastguard Worker { 106*61c4878aSAndroid Build Coastguard Worker "pw": { 107*61c4878aSAndroid Build Coastguard Worker "pw_cli": { 108*61c4878aSAndroid Build Coastguard Worker "plugins": { 109*61c4878aSAndroid Build Coastguard Worker "presubmit": { 110*61c4878aSAndroid Build Coastguard Worker "module": "my_cool_project.tools", 111*61c4878aSAndroid Build Coastguard Worker "function": "run_presubmit" 112*61c4878aSAndroid Build Coastguard Worker }, 113*61c4878aSAndroid Build Coastguard Worker "test": { 114*61c4878aSAndroid Build Coastguard Worker "module": "my_cool_project.testing", 115*61c4878aSAndroid Build Coastguard Worker "function": "run_test" 116*61c4878aSAndroid Build Coastguard Worker }, 117*61c4878aSAndroid Build Coastguard Worker "flash": { 118*61c4878aSAndroid Build Coastguard Worker "module": "my_cool_project.flash", 119*61c4878aSAndroid Build Coastguard Worker "function": "main" 120*61c4878aSAndroid Build Coastguard Worker } 121*61c4878aSAndroid Build Coastguard Worker } 122*61c4878aSAndroid Build Coastguard Worker } 123*61c4878aSAndroid Build Coastguard Worker } 124*61c4878aSAndroid Build Coastguard Worker } 125*61c4878aSAndroid Build Coastguard Worker 126*61c4878aSAndroid Build Coastguard WorkerDefining a plugin function 127*61c4878aSAndroid Build Coastguard Worker========================== 128*61c4878aSAndroid Build Coastguard WorkerAny function without required arguments may be used as a plugin function. The 129*61c4878aSAndroid Build Coastguard Workerfunction should return an int, which the ``pw`` uses as the exit code. The 130*61c4878aSAndroid Build Coastguard Worker``pw`` tool uses the function docstring as the help string for the command. 131*61c4878aSAndroid Build Coastguard Worker 132*61c4878aSAndroid Build Coastguard WorkerTypically, ``pw`` commands parse their arguments with the ``argparse`` module. 133*61c4878aSAndroid Build Coastguard Worker``pw`` sets ``sys.argv`` so it contains only the arguments for the plugin, 134*61c4878aSAndroid Build Coastguard Workerso plugins can behave the same whether they are executed independently or 135*61c4878aSAndroid Build Coastguard Workerthrough ``pw``. 136*61c4878aSAndroid Build Coastguard Worker 137*61c4878aSAndroid Build Coastguard WorkerExample 138*61c4878aSAndroid Build Coastguard Worker------- 139*61c4878aSAndroid Build Coastguard WorkerThis example shows a function that is registered as a ``pw`` plugin. 140*61c4878aSAndroid Build Coastguard Worker 141*61c4878aSAndroid Build Coastguard Worker.. code-block:: python 142*61c4878aSAndroid Build Coastguard Worker 143*61c4878aSAndroid Build Coastguard Worker # my_package/my_module.py 144*61c4878aSAndroid Build Coastguard Worker 145*61c4878aSAndroid Build Coastguard Worker def _do_something(device): 146*61c4878aSAndroid Build Coastguard Worker ... 147*61c4878aSAndroid Build Coastguard Worker 148*61c4878aSAndroid Build Coastguard Worker def main() -> int: 149*61c4878aSAndroid Build Coastguard Worker """Do something to a connected device.""" 150*61c4878aSAndroid Build Coastguard Worker 151*61c4878aSAndroid Build Coastguard Worker parser = argparse.ArgumentParser(description=__doc__) 152*61c4878aSAndroid Build Coastguard Worker parser.add_argument('--device', help='Set which device to target') 153*61c4878aSAndroid Build Coastguard Worker return _do_something(**vars(parser.parse_args())) 154*61c4878aSAndroid Build Coastguard Worker 155*61c4878aSAndroid Build Coastguard Worker 156*61c4878aSAndroid Build Coastguard Worker if __name__ == '__main__': 157*61c4878aSAndroid Build Coastguard Worker logging.basicConfig(format='%(message)s', level=logging.INFO) 158*61c4878aSAndroid Build Coastguard Worker sys.exit(main()) 159*61c4878aSAndroid Build Coastguard Worker 160*61c4878aSAndroid Build Coastguard WorkerThis plugin is registered in a ``PW_PLUGINS`` file in the current working 161*61c4878aSAndroid Build Coastguard Workerdirectory or a parent of it. 162*61c4878aSAndroid Build Coastguard Worker 163*61c4878aSAndroid Build Coastguard Worker.. code-block:: python 164*61c4878aSAndroid Build Coastguard Worker 165*61c4878aSAndroid Build Coastguard Worker # Register my_commmand 166*61c4878aSAndroid Build Coastguard Worker my_command my_package.my_module main 167*61c4878aSAndroid Build Coastguard Worker 168*61c4878aSAndroid Build Coastguard WorkerThe function is now available through the ``pw`` command, and will be listed in 169*61c4878aSAndroid Build Coastguard Worker``pw``'s help. Arguments after the command name are passed to the plugin. 170*61c4878aSAndroid Build Coastguard Worker 171*61c4878aSAndroid Build Coastguard Worker.. code-block:: text 172*61c4878aSAndroid Build Coastguard Worker 173*61c4878aSAndroid Build Coastguard Worker $ pw 174*61c4878aSAndroid Build Coastguard Worker 175*61c4878aSAndroid Build Coastguard Worker ▒█████▄ █▓ ▄███▒ ▒█ ▒█ ░▓████▒ ░▓████▒ ▒▓████▄ 176*61c4878aSAndroid Build Coastguard Worker ▒█░ █░ ░█▒ ██▒ ▀█▒ ▒█░ █ ▒█ ▒█ ▀ ▒█ ▀ ▒█ ▀█▌ 177*61c4878aSAndroid Build Coastguard Worker ▒█▄▄▄█░ ░█▒ █▓░ ▄▄░ ▒█░ █ ▒█ ▒███ ▒███ ░█ █▌ 178*61c4878aSAndroid Build Coastguard Worker ▒█▀ ░█░ ▓█ █▓ ░█░ █ ▒█ ▒█ ▄ ▒█ ▄ ░█ ▄█▌ 179*61c4878aSAndroid Build Coastguard Worker ▒█ ░█░ ░▓███▀ ▒█▓▀▓█░ ░▓████▒ ░▓████▒ ▒▓████▀ 180*61c4878aSAndroid Build Coastguard Worker 181*61c4878aSAndroid Build Coastguard Worker usage: pw [-h] [-C DIRECTORY] [-l LOGLEVEL] [--no-banner] [command] ... 182*61c4878aSAndroid Build Coastguard Worker 183*61c4878aSAndroid Build Coastguard Worker The Pigweed command line interface (CLI). 184*61c4878aSAndroid Build Coastguard Worker 185*61c4878aSAndroid Build Coastguard Worker ... 186*61c4878aSAndroid Build Coastguard Worker 187*61c4878aSAndroid Build Coastguard Worker supported commands: 188*61c4878aSAndroid Build Coastguard Worker doctor Check that the environment is set up correctly for Pigweed. 189*61c4878aSAndroid Build Coastguard Worker format Check and fix formatting for source files. 190*61c4878aSAndroid Build Coastguard Worker help Display detailed information about pw commands. 191*61c4878aSAndroid Build Coastguard Worker ... 192*61c4878aSAndroid Build Coastguard Worker my_command Do something to a connected device. 193*61c4878aSAndroid Build Coastguard Worker 194*61c4878aSAndroid Build Coastguard Worker $ pw my_command -h 195*61c4878aSAndroid Build Coastguard Worker 196*61c4878aSAndroid Build Coastguard Worker ▒█████▄ █▓ ▄███▒ ▒█ ▒█ ░▓████▒ ░▓████▒ ▒▓████▄ 197*61c4878aSAndroid Build Coastguard Worker ▒█░ █░ ░█▒ ██▒ ▀█▒ ▒█░ █ ▒█ ▒█ ▀ ▒█ ▀ ▒█ ▀█▌ 198*61c4878aSAndroid Build Coastguard Worker ▒█▄▄▄█░ ░█▒ █▓░ ▄▄░ ▒█░ █ ▒█ ▒███ ▒███ ░█ █▌ 199*61c4878aSAndroid Build Coastguard Worker ▒█▀ ░█░ ▓█ █▓ ░█░ █ ▒█ ▒█ ▄ ▒█ ▄ ░█ ▄█▌ 200*61c4878aSAndroid Build Coastguard Worker ▒█ ░█░ ░▓███▀ ▒█▓▀▓█░ ░▓████▒ ░▓████▒ ▒▓████▀ 201*61c4878aSAndroid Build Coastguard Worker 202*61c4878aSAndroid Build Coastguard Worker usage: pw my_command [-h] [--device DEVICE] 203*61c4878aSAndroid Build Coastguard Worker 204*61c4878aSAndroid Build Coastguard Worker Do something to a connected device. 205*61c4878aSAndroid Build Coastguard Worker 206*61c4878aSAndroid Build Coastguard Worker optional arguments: 207*61c4878aSAndroid Build Coastguard Worker -h, --help show this help message and exit 208*61c4878aSAndroid Build Coastguard Worker --device DEVICE Set which device to target 209*61c4878aSAndroid Build Coastguard Worker 210*61c4878aSAndroid Build Coastguard Worker.. _module-pw_cli-aliases: 211*61c4878aSAndroid Build Coastguard Worker 212*61c4878aSAndroid Build Coastguard WorkerDefining a simple alias 213*61c4878aSAndroid Build Coastguard Worker======================= 214*61c4878aSAndroid Build Coastguard WorkerFor simpler ``pw`` subcommands that effectively only need to act as command line 215*61c4878aSAndroid Build Coastguard Workeraliases, the ``pw_cli.alias`` python module can be reused for simplicity. 216*61c4878aSAndroid Build Coastguard Worker 217*61c4878aSAndroid Build Coastguard WorkerFirst, create a python module that defines the alias: 218*61c4878aSAndroid Build Coastguard Worker 219*61c4878aSAndroid Build Coastguard Worker.. code-block:: python 220*61c4878aSAndroid Build Coastguard Worker 221*61c4878aSAndroid Build Coastguard Worker # my_package/aliases.py 222*61c4878aSAndroid Build Coastguard Worker 223*61c4878aSAndroid Build Coastguard Worker from pw_cli.aliases import alias 224*61c4878aSAndroid Build Coastguard Worker 225*61c4878aSAndroid Build Coastguard Worker foo = alias("bar", "baz") 226*61c4878aSAndroid Build Coastguard Worker 227*61c4878aSAndroid Build Coastguard WorkerThe remaining step needed is to add a new plugin to ``pigweed.json``: 228*61c4878aSAndroid Build Coastguard Worker 229*61c4878aSAndroid Build Coastguard Worker.. code-block:: 230*61c4878aSAndroid Build Coastguard Worker 231*61c4878aSAndroid Build Coastguard Worker { 232*61c4878aSAndroid Build Coastguard Worker "pw": { 233*61c4878aSAndroid Build Coastguard Worker "pw_cli": { 234*61c4878aSAndroid Build Coastguard Worker "plugins": { 235*61c4878aSAndroid Build Coastguard Worker "foo": { 236*61c4878aSAndroid Build Coastguard Worker "module": "my_package.aliases", 237*61c4878aSAndroid Build Coastguard Worker "function": "foo" 238*61c4878aSAndroid Build Coastguard Worker }, 239*61c4878aSAndroid Build Coastguard Worker ... 240*61c4878aSAndroid Build Coastguard Worker } 241*61c4878aSAndroid Build Coastguard Worker } 242*61c4878aSAndroid Build Coastguard Worker } 243*61c4878aSAndroid Build Coastguard Worker } 244*61c4878aSAndroid Build Coastguard Worker 245*61c4878aSAndroid Build Coastguard WorkerIn this case, the command ``pw foo abc`` will effectively run ``bar baz abc``. 246*61c4878aSAndroid Build Coastguard Worker 247*61c4878aSAndroid Build Coastguard Worker-------------------------- 248*61c4878aSAndroid Build Coastguard WorkerBranding Pigweed's tooling 249*61c4878aSAndroid Build Coastguard Worker-------------------------- 250*61c4878aSAndroid Build Coastguard WorkerAn important part of starting a new project is picking a name, and in the case 251*61c4878aSAndroid Build Coastguard Workerof Pigweed, designing a banner for the project. Pigweed supports configuring 252*61c4878aSAndroid Build Coastguard Workerthe banners by setting environment variables: 253*61c4878aSAndroid Build Coastguard Worker 254*61c4878aSAndroid Build Coastguard Worker* ``PW_BRANDING_BANNER`` - Absolute path to a filename containing a banner to 255*61c4878aSAndroid Build Coastguard Worker display when running the ``pw`` commands. See the example below. 256*61c4878aSAndroid Build Coastguard Worker* ``PW_BRANDING_BANNER_COLOR`` - Color of the banner. Possible values include: 257*61c4878aSAndroid Build Coastguard Worker ``red``, ``bold_red``, ``yellow``, ``bold_yellow``, ``green``, 258*61c4878aSAndroid Build Coastguard Worker ``bold_green``, ``blue``, ``cyan``, ``magenta``, ``bold_white``, 259*61c4878aSAndroid Build Coastguard Worker ``black_on_white``. See ``pw_cli.colors`` for details. 260*61c4878aSAndroid Build Coastguard Worker* ``PW_ENVSETUP_NO_BANNER`` - Suppress banner from being printed. 261*61c4878aSAndroid Build Coastguard Worker 262*61c4878aSAndroid Build Coastguard WorkerThe below example shows how to manually change the branding at the command 263*61c4878aSAndroid Build Coastguard Workerline. However, these environment variables should be set in the project root's 264*61c4878aSAndroid Build Coastguard Worker``bootstrap.sh`` before delegating to Pigweed's upstream ``bootstrap.sh``. 265*61c4878aSAndroid Build Coastguard Worker 266*61c4878aSAndroid Build Coastguard Worker.. code-block:: text 267*61c4878aSAndroid Build Coastguard Worker 268*61c4878aSAndroid Build Coastguard Worker $ cat foo-banner.txt 269*61c4878aSAndroid Build Coastguard Worker 270*61c4878aSAndroid Build Coastguard Worker ▒██████ ░▓██▓░ ░▓██▓░ 271*61c4878aSAndroid Build Coastguard Worker ▒█░ ▒█ ▒█ ▒█ ▒█ 272*61c4878aSAndroid Build Coastguard Worker ▒█▄▄▄▄ ▒█ █ ▒█ ▒█ █ ▒█ 273*61c4878aSAndroid Build Coastguard Worker ▒█▀ ▒█ ▒█ ▒█ ▒█ 274*61c4878aSAndroid Build Coastguard Worker ▒█ ░▓██▓░ ░▓██▓░ 275*61c4878aSAndroid Build Coastguard Worker 276*61c4878aSAndroid Build Coastguard Worker $ export PW_BRANDING_BANNER="$(pwd)/foo-banner.txt" 277*61c4878aSAndroid Build Coastguard Worker $ export PW_BRANDING_BANNER_COLOR="bold_red" 278*61c4878aSAndroid Build Coastguard Worker $ pw logdemo 279*61c4878aSAndroid Build Coastguard Worker 280*61c4878aSAndroid Build Coastguard Worker ▒██████ ░▓██▓░ ░▓██▓░ 281*61c4878aSAndroid Build Coastguard Worker ▒█░ ▒█ ▒█ ▒█ ▒█ 282*61c4878aSAndroid Build Coastguard Worker ▒█▄▄▄▄ ▒█ █ ▒█ ▒█ █ ▒█ 283*61c4878aSAndroid Build Coastguard Worker ▒█▀ ▒█ ▒█ ▒█ ▒█ 284*61c4878aSAndroid Build Coastguard Worker ▒█ ░▓██▓░ ░▓██▓░ 285*61c4878aSAndroid Build Coastguard Worker 286*61c4878aSAndroid Build Coastguard Worker 20200610 12:03:44 CRT This is a critical message 287*61c4878aSAndroid Build Coastguard Worker 20200610 12:03:44 ERR There was an error on our last operation 288*61c4878aSAndroid Build Coastguard Worker 20200610 12:03:44 WRN Looks like something is amiss; consider investigating 289*61c4878aSAndroid Build Coastguard Worker 20200610 12:03:44 INF The operation went as expected 290*61c4878aSAndroid Build Coastguard Worker 20200610 12:03:44 OUT Standard output of subprocess 291*61c4878aSAndroid Build Coastguard Worker 292*61c4878aSAndroid Build Coastguard WorkerThe branding is not purely visual; it serves to make it clear which project an 293*61c4878aSAndroid Build Coastguard Workerengineer is working with. 294*61c4878aSAndroid Build Coastguard Worker 295*61c4878aSAndroid Build Coastguard WorkerMaking the ASCII / ANSI art 296*61c4878aSAndroid Build Coastguard Worker=========================== 297*61c4878aSAndroid Build Coastguard WorkerThe most direct way to make the ASCII art is to create it with a text editor. 298*61c4878aSAndroid Build Coastguard WorkerHowever, there are some tools to make the process faster and easier. 299*61c4878aSAndroid Build Coastguard Worker 300*61c4878aSAndroid Build Coastguard Worker* `Patorjk's ASCII art generator <http://patorjk.com/software/taag/>`_ - A 301*61c4878aSAndroid Build Coastguard Worker great starting place, since you can copy and paste straight from the browser 302*61c4878aSAndroid Build Coastguard Worker into a file, and then point ``PW_BRANDING_BANNER`` at it. Most of the fonts 303*61c4878aSAndroid Build Coastguard Worker use normal ASCII characters; and fonts with extended ASCII characters use the 304*61c4878aSAndroid Build Coastguard Worker Unicode versions of them (needed for modern terminals). 305*61c4878aSAndroid Build Coastguard Worker 306*61c4878aSAndroid Build Coastguard WorkerThere are other options, but these require additional work to put into Pigweed 307*61c4878aSAndroid Build Coastguard Workersince they only export in the traditional ANS or ICE formats. The old ANS 308*61c4878aSAndroid Build Coastguard Workerformats do not have a converter (contributions welcome!). Here are some of the 309*61c4878aSAndroid Build Coastguard Workeroptions as of mid-2020: 310*61c4878aSAndroid Build Coastguard Worker 311*61c4878aSAndroid Build Coastguard Worker* `Playscii <http://vectorpoem.com/playscii/>`_ - Actively maintained. 312*61c4878aSAndroid Build Coastguard Worker* `Moebius <https://github.com/blocktronics/moebius>`_ - Actively maintained. 313*61c4878aSAndroid Build Coastguard Worker* `SyncDraw <http://syncdraw.bbsdev.net/>`_ - Actively maintained, in 2020, in 314*61c4878aSAndroid Build Coastguard Worker a CVS repository. 315*61c4878aSAndroid Build Coastguard Worker* `PabloDraw <http://picoe.ca/products/pablodraw/>`_ - Works on most desktop 316*61c4878aSAndroid Build Coastguard Worker machines thanks to being written in .NET. Not maintained, but works well. Has 317*61c4878aSAndroid Build Coastguard Worker an impresive brush system for organic style drawing. 318*61c4878aSAndroid Build Coastguard Worker* `TheDraw <https://en.wikipedia.org/wiki/TheDraw>`_ - One of the most popular 319*61c4878aSAndroid Build Coastguard Worker ANSI art editors back in the 90s. Requires DOSBox to run on modern machines, 320*61c4878aSAndroid Build Coastguard Worker but otherwise works. It has some of the most impressive capabilities, 321*61c4878aSAndroid Build Coastguard Worker including supporting full-color multi-character fonts. 322*61c4878aSAndroid Build Coastguard Worker 323*61c4878aSAndroid Build Coastguard WorkerFuture branding improvements 324*61c4878aSAndroid Build Coastguard Worker============================ 325*61c4878aSAndroid Build Coastguard WorkerBranding the ``pw`` tool is a great start, but more changes are planned: 326*61c4878aSAndroid Build Coastguard Worker 327*61c4878aSAndroid Build Coastguard Worker- Supporting branding the ``bootstrap/activate`` banner, which for technical 328*61c4878aSAndroid Build Coastguard Worker reasons is not the same code as the banner printing from the Python tooling. 329*61c4878aSAndroid Build Coastguard Worker These will use the same ``PW_BRANDING_BANNER`` and 330*61c4878aSAndroid Build Coastguard Worker ``PW_BRANDING_BANNER_COLOR`` environment variables. 331*61c4878aSAndroid Build Coastguard Worker- Supporting renaming the ``pw`` command to something project specific, like 332*61c4878aSAndroid Build Coastguard Worker ``foo`` in this case. 333*61c4878aSAndroid Build Coastguard Worker- Re-coloring the log headers from the ``pw`` tool. 334*61c4878aSAndroid Build Coastguard Worker 335*61c4878aSAndroid Build Coastguard Worker.. toctree:: 336*61c4878aSAndroid Build Coastguard Worker :hidden: 337*61c4878aSAndroid Build Coastguard Worker :maxdepth: 1 338*61c4878aSAndroid Build Coastguard Worker 339*61c4878aSAndroid Build Coastguard Worker api 340