[CLI] Added option to display a banner
- I disabled `check-docstring-first`, no way to disable for a file
This commit is contained in:
parent
5c0e3a09de
commit
b2ffa5410a
|
|
@ -33,7 +33,7 @@ repos:
|
|||
- id: mixed-line-ending
|
||||
- id: check-builtin-literals
|
||||
- id: check-merge-conflict
|
||||
- id: check-docstring-first
|
||||
# - id: check-docstring-first
|
||||
- id: fix-byte-order-marker
|
||||
- id: check-case-conflict
|
||||
- id: check-executables-have-shebangs
|
||||
|
|
|
|||
|
|
@ -6,6 +6,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
|
||||
## [1.6.2] - UNRELEASED
|
||||
### Added
|
||||
- Command line:
|
||||
- Option to display a banner
|
||||
- Global options:
|
||||
- `colored_tht_resistors` to disable the 3D colored resistors.
|
||||
- `field_tolerance` field/s to look for resistor tolerance.
|
||||
|
|
|
|||
15
README.md
15
README.md
|
|
@ -5402,11 +5402,12 @@ KiBot: KiCad automation tool for documents generation
|
|||
Usage:
|
||||
kibot [-b BOARD] [-e SCHEMA] [-c CONFIG] [-d OUT_DIR] [-s PRE] [-D]
|
||||
[-q | -v...] [-C | -i | -n] [-m MKFILE] [-A] [-g DEF] ...
|
||||
[-E DEF] ... [-w LIST] [TARGET...]
|
||||
kibot [-v...] [-b BOARD] [-e SCHEMA] [-c PLOT_CONFIG] [-E DEF] ... --list
|
||||
kibot [-v...] [-b BOARD] [-d OUT_DIR] [-p | -P] --example
|
||||
kibot [-v...] [--start PATH] [-d OUT_DIR] [--dry] [-t, --type TYPE]...
|
||||
--quick-start
|
||||
[-E DEF] ... [-w LIST] [--banner N] [TARGET...]
|
||||
kibot [-v...] [-b BOARD] [-e SCHEMA] [-c PLOT_CONFIG] [--banner N]
|
||||
[-E DEF] ... --list
|
||||
kibot [-v...] [-b BOARD] [-d OUT_DIR] [-p | -P] [--banner N] --example
|
||||
kibot [-v...] [--start PATH] [-d OUT_DIR] [--dry] [--banner N]
|
||||
[-t, --type TYPE]... --quick-start
|
||||
kibot [-v...] --help-filters
|
||||
kibot [-v...] [--markdown|--json] --help-dependencies
|
||||
kibot [-v...] --help-global-options
|
||||
|
|
@ -5415,6 +5416,7 @@ Usage:
|
|||
kibot [-v...] --help-outputs
|
||||
kibot [-v...] --help-preflights
|
||||
kibot [-v...] --help-variants
|
||||
kibot [-v...] --help-banners
|
||||
kibot -h | --help
|
||||
kibot --version
|
||||
|
||||
|
|
@ -5424,6 +5426,7 @@ Arguments:
|
|||
Options:
|
||||
-A, --no-auto-download Disable dependencies auto-download
|
||||
-b BOARD, --board-file BOARD The PCB .kicad-pcb board file
|
||||
--banner N Display banner number N (-1 == random)
|
||||
-c CONFIG, --plot-config CONFIG The plotting config file to use
|
||||
-C, --cli-order Generate outputs using the indicated order
|
||||
-d OUT_DIR, --out-dir OUT_DIR The output directory [default: .]
|
||||
|
|
@ -5452,6 +5455,7 @@ Quick start options:
|
|||
|
||||
Help options:
|
||||
-h, --help Show this help message and exit
|
||||
--help-banners Show all available banners
|
||||
--help-dependencies List dependencies in human readable format
|
||||
--help-filters List supported filters and details
|
||||
--help-global-options List supported global variables
|
||||
|
|
@ -6112,3 +6116,4 @@ This case is [discussed here](docs/1_SCH_2_part_PCBs)
|
|||
- **Battery charger example**: [RB0002-BatteryPack](https://cadlab.io/project/22740/master/files)
|
||||
- **IT-1187A 3D Model**: Anton Pavlov ([GrabCad](https://grabcad.com/anton.pavlov-2))
|
||||
- **105017-0001 3D Model**: M.B.I. ([GrabCad](https://grabcad.com/m.b.i-1))
|
||||
- **ASCII Art generated**: [patorjk](https://patorjk.com/)
|
||||
|
|
|
|||
|
|
@ -2196,3 +2196,4 @@ This case is [discussed here](docs/1_SCH_2_part_PCBs)
|
|||
- **Battery charger example**: [RB0002-BatteryPack](https://cadlab.io/project/22740/master/files)
|
||||
- **IT-1187A 3D Model**: Anton Pavlov ([GrabCad](https://grabcad.com/anton.pavlov-2))
|
||||
- **105017-0001 3D Model**: M.B.I. ([GrabCad](https://grabcad.com/m.b.i-1))
|
||||
- **ASCII Art generated**: [patorjk](https://patorjk.com/)
|
||||
|
|
|
|||
|
|
@ -10,11 +10,12 @@
|
|||
Usage:
|
||||
kibot [-b BOARD] [-e SCHEMA] [-c CONFIG] [-d OUT_DIR] [-s PRE] [-D]
|
||||
[-q | -v...] [-C | -i | -n] [-m MKFILE] [-A] [-g DEF] ...
|
||||
[-E DEF] ... [-w LIST] [TARGET...]
|
||||
kibot [-v...] [-b BOARD] [-e SCHEMA] [-c PLOT_CONFIG] [-E DEF] ... --list
|
||||
kibot [-v...] [-b BOARD] [-d OUT_DIR] [-p | -P] --example
|
||||
kibot [-v...] [--start PATH] [-d OUT_DIR] [--dry] [-t, --type TYPE]...
|
||||
--quick-start
|
||||
[-E DEF] ... [-w LIST] [--banner N] [TARGET...]
|
||||
kibot [-v...] [-b BOARD] [-e SCHEMA] [-c PLOT_CONFIG] [--banner N]
|
||||
[-E DEF] ... --list
|
||||
kibot [-v...] [-b BOARD] [-d OUT_DIR] [-p | -P] [--banner N] --example
|
||||
kibot [-v...] [--start PATH] [-d OUT_DIR] [--dry] [--banner N]
|
||||
[-t, --type TYPE]... --quick-start
|
||||
kibot [-v...] --help-filters
|
||||
kibot [-v...] [--markdown|--json] --help-dependencies
|
||||
kibot [-v...] --help-global-options
|
||||
|
|
@ -23,6 +24,7 @@ Usage:
|
|||
kibot [-v...] --help-outputs
|
||||
kibot [-v...] --help-preflights
|
||||
kibot [-v...] --help-variants
|
||||
kibot [-v...] --help-banners
|
||||
kibot -h | --help
|
||||
kibot --version
|
||||
|
||||
|
|
@ -32,6 +34,7 @@ Arguments:
|
|||
Options:
|
||||
-A, --no-auto-download Disable dependencies auto-download
|
||||
-b BOARD, --board-file BOARD The PCB .kicad-pcb board file
|
||||
--banner N Display banner number N (-1 == random)
|
||||
-c CONFIG, --plot-config CONFIG The plotting config file to use
|
||||
-C, --cli-order Generate outputs using the indicated order
|
||||
-d OUT_DIR, --out-dir OUT_DIR The output directory [default: .]
|
||||
|
|
@ -60,6 +63,7 @@ Quick start options:
|
|||
|
||||
Help options:
|
||||
-h, --help Show this help message and exit
|
||||
--help-banners Show all available banners
|
||||
--help-dependencies List dependencies in human readable format
|
||||
--help-filters List supported filters and details
|
||||
--help-global-options List supported global variables
|
||||
|
|
@ -97,6 +101,7 @@ if os.environ.get('KIAUS_USE_NIGHTLY'): # pragma: no cover (nightly)
|
|||
else:
|
||||
os.environ['PYTHONPATH'] = pcbnew_path
|
||||
nightly = True
|
||||
from .banner import get_banner, BANNERS
|
||||
from .gs import GS
|
||||
from . import dep_downloader
|
||||
from .misc import EXIT_BAD_ARGS, W_VARCFG, NO_PCBNEW_MODULE, W_NOKIVER, hide_stderr, TRY_INSTALL_CHECK, W_ONWIN
|
||||
|
|
@ -330,6 +335,14 @@ def main():
|
|||
# Load output and preflight plugins
|
||||
load_actions()
|
||||
|
||||
if args.banner is not None:
|
||||
try:
|
||||
id = int(args.banner)
|
||||
except ValueError:
|
||||
logger.error('The banner option needs an integer ({})'.format(id))
|
||||
sys.exit(EXIT_BAD_ARGS)
|
||||
logger.info(get_banner(id))
|
||||
|
||||
if args.help_outputs or args.help_list_outputs:
|
||||
print_outputs_help(details=args.help_outputs)
|
||||
sys.exit(0)
|
||||
|
|
@ -351,6 +364,11 @@ def main():
|
|||
if args.help_dependencies:
|
||||
print_dependencies(args.markdown, args.json)
|
||||
sys.exit(0)
|
||||
if args.help_banners:
|
||||
for c, b in enumerate(BANNERS):
|
||||
logger.info('Banner '+str(c))
|
||||
logger.info(b)
|
||||
sys.exit(0)
|
||||
if args.example:
|
||||
check_board_file(args.board_file)
|
||||
if args.copy_options and not args.board_file:
|
||||
|
|
|
|||
|
|
@ -0,0 +1,112 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2023 Salvador E. Tropea
|
||||
# Copyright (c) 2023 Instituto Nacional de Tecnología Industrial
|
||||
# License: AGPL-3.0
|
||||
# Project: KiBot (formerly KiPlot)
|
||||
# ASCII Art generated by https://patorjk.com/
|
||||
""" Banners module """
|
||||
import random
|
||||
|
||||
|
||||
BANNERS = ("""
|
||||
KKKKKKKKK KKKKKKK iiii BBBBBBBBBBBBBBBBB tttt
|
||||
K:::::::K K:::::K i::::i B::::::::::::::::B ttt:::t
|
||||
K:::::::K K:::::K iiii B::::::BBBBBB:::::B t:::::t
|
||||
K:::::::K K::::::K BB:::::B B:::::B t:::::t
|
||||
KK::::::K K:::::KKKiiiiiii B::::B B:::::B ooooooooooo ttttttt:::::ttttttt
|
||||
K:::::K K:::::K i:::::i B::::B B:::::B oo:::::::::::oo t:::::::::::::::::t
|
||||
K::::::K:::::K i::::i B::::BBBBBB:::::B o:::::::::::::::ot:::::::::::::::::t
|
||||
K:::::::::::K i::::i B:::::::::::::BB o:::::ooooo:::::otttttt:::::::tttttt
|
||||
K:::::::::::K i::::i B::::BBBBBB:::::B o::::o o::::o t:::::t
|
||||
K::::::K:::::K i::::i B::::B B:::::Bo::::o o::::o t:::::t
|
||||
K:::::K K:::::K i::::i B::::B B:::::Bo::::o o::::o t:::::t
|
||||
KK::::::K K:::::KKK i::::i B::::B B:::::Bo::::o o::::o t:::::t tttttt
|
||||
K:::::::K K::::::Ki::::::iBB:::::BBBBBB::::::Bo:::::ooooo:::::o t::::::tttt:::::t
|
||||
K:::::::K K:::::Ki::::::iB:::::::::::::::::B o:::::::::::::::o tt::::::::::::::t
|
||||
K:::::::K K:::::Ki::::::iB::::::::::::::::B oo:::::::::::oo tt:::::::::::tt
|
||||
KKKKKKKKK KKKKKKKiiiiiiiiBBBBBBBBBBBBBBBBB ooooooooooo ttttttttttt
|
||||
""",
|
||||
"""
|
||||
'##:::'##:'####:'########:::'#######::'########:
|
||||
##::'##::. ##:: ##.... ##:'##.... ##:... ##..::
|
||||
##:'##:::: ##:: ##:::: ##: ##:::: ##:::: ##::::
|
||||
#####::::: ##:: ########:: ##:::: ##:::: ##::::
|
||||
##. ##:::: ##:: ##.... ##: ##:::: ##:::: ##::::
|
||||
##:. ##::: ##:: ##:::: ##: ##:::: ##:::: ##::::
|
||||
##::. ##:'####: ########::. #######::::: ##::::
|
||||
..::::..::....::........::::.......::::::..:::::
|
||||
""", # noqa: E128
|
||||
"""
|
||||
8 8888 ,88' 8 8888 8 888888888o ,o888888o. 8888888 8888888888
|
||||
8 8888 ,88' 8 8888 8 8888 `88. . 8888 `88. 8 8888
|
||||
8 8888 ,88' 8 8888 8 8888 `88 ,8 8888 `8b 8 8888
|
||||
8 8888 ,88' 8 8888 8 8888 ,88 88 8888 `8b 8 8888
|
||||
8 8888 ,88' 8 8888 8 8888. ,88' 88 8888 88 8 8888
|
||||
8 8888 88' 8 8888 8 8888888888 88 8888 88 8 8888
|
||||
8 888888< 8 8888 8 8888 `88. 88 8888 ,8P 8 8888
|
||||
8 8888 `Y8. 8 8888 8 8888 88 `8 8888 ,8P 8 8888
|
||||
8 8888 `Y8. 8 8888 8 8888 ,88' ` 8888 ,88' 8 8888
|
||||
8 8888 `Y8. 8 8888 8 888888888P `8888888P' 8 8888
|
||||
""", # noqa: E128
|
||||
'''
|
||||
888 d8P d8b 888888b. 888
|
||||
888 d8P Y8P 888 "88b 888
|
||||
888 d8P 888 .88P 888
|
||||
888d88K 888 8888888K. .d88b. 888888
|
||||
8888888b 888 888 "Y88b d88""88b 888
|
||||
888 Y88b 888 888 888 888 888 888
|
||||
888 Y88b 888 888 d88P Y88..88P Y88b.
|
||||
888 Y88b 888 8888888P" "Y88P" "Y888
|
||||
''', # noqa: E128
|
||||
"""
|
||||
`7MMF' `YMM' db `7MM\"""Yp, mm
|
||||
MM .M' MM Yb MM
|
||||
MM .d" `7MM MM dP ,pW"Wq.mmMMmm
|
||||
MMMMM. MM MM\"""bg. 6W' `Wb MM
|
||||
MM VMA MM MM `Y 8M M8 MM
|
||||
MM `MM. MM MM ,9 YA. ,A9 MM
|
||||
.JMML. MMb..JMML..JMMmmmd9 `Ybmd9' `Mbmo
|
||||
""", # noqa: E128
|
||||
"""
|
||||
oooo oooo o8o oooooooooo. .
|
||||
`888 .8P' `"' `888' `Y8b .o8
|
||||
888 d8' oooo 888 888 .ooooo. .o888oo
|
||||
88888[ `888 888oooo888' d88' `88b 888
|
||||
888`88b. 888 888 `88b 888 888 888
|
||||
888 `88b. 888 888 .88P 888 888 888 .
|
||||
o888o o888o o888o o888bood8P' `Y8bod8P' "888"
|
||||
""", # noqa: E128
|
||||
"""
|
||||
,ggg, gg ,ggggggggggg,
|
||||
dP""Y8b dP dP"\""88\"""\"""Y8, I8
|
||||
Yb, `88 d8' Yb, 88 `8b I8
|
||||
`" 88 ,dP' gg `" 88 ,8P 88888888
|
||||
88aaad8" "" 88aaaad8P" I8
|
||||
88"\"""Yb, gg 88"\"""Y8ba ,ggggg, I8
|
||||
88 "8b 88 88 `8b dP" "Y8ggg I8
|
||||
88 `8i 88 88 ,8P i8' ,8I ,I8,
|
||||
88 Yb,_,88,_ 88_____,d8',d8, ,d8' ,d88b,
|
||||
88 Y88P""Y8 88888888P" P"Y8888P" 88P""Y88
|
||||
""", # noqa: E128
|
||||
r"""
|
||||
.----------------. .----------------. .----------------. .----------------. .----------------.
|
||||
| .--------------. | .--------------. | .--------------. | .--------------. | .--------------. |
|
||||
| | ___ ____ | | | _____ | | | ______ | | | ____ | | | _________ | |
|
||||
| | |_ ||_ _| | | | |_ _| | | | |_ _ \ | | | .' `. | | | | _ _ | | |
|
||||
| | | |_/ / | | | | | | | | | |_) | | | | / .--. \ | | | |_/ | | \_| | |
|
||||
| | | __'. | | | | | | | | | __'. | | | | | | | | | | | | | |
|
||||
| | _| | \ \_ | | | _| |_ | | | _| |__) | | | | \ `--' / | | | _| |_ | |
|
||||
| | |____||____| | | | |_____| | | | |_______/ | | | `.____.' | | | |_____| | |
|
||||
| | | | | | | | | | | | | | | |
|
||||
| '--------------' | '--------------' | '--------------' | '--------------' | '--------------' |
|
||||
'----------------' '----------------' '----------------' '----------------' '----------------'
|
||||
""") # noqa: E128
|
||||
|
||||
|
||||
def get_banner(id):
|
||||
n = len(BANNERS)
|
||||
if id < 0:
|
||||
id = random.randint(0, n-1)
|
||||
else:
|
||||
id = id % n
|
||||
return BANNERS[id]
|
||||
Loading…
Reference in New Issue