Sample CLI
gway awg find-cable
Signature
(*, meters: Union[int, str, NoneType] = None, amps: Union[int, str] = '40', volts: Union[int, str] =
'220', material: Literal['cu', 'al', '?'] = 'cu', max_lines: Union[int, str] = '1', phases:
Literal['1', '3', 1, 3] = '2', conduit: Union[str, bool, NoneType] = None, ground: Union[int, str] =
'1')
Docstring
Calculate the type of cable needed for an electrical system.
Args:
meters: Cable length (one line) in meters. Required keyword.
amps: Load in Amperes. Default: 40 A.
volts: System voltage. Default: 220 V.
material: 'cu' (copper) or 'al' (aluminum). Default: cu.
max_lines: Maximum number of line conductors allowed. Default: 1
phases: Number of phases for AC (1, 2 or 3). Default: 2
conduit: Conduit type or None.
ground: Number of ground wires.
Returns:
dict with cable selection and voltage drop info, or {'awg': 'n/a'} if not possible.
Signature
(value=None, *, notify=True, when=None)
Docstring
Extracts or updates the clipboard contents.
Args:
value (str, optional): The value to copy to clipboard. If None, only reads the clipboard.
notify (bool, optional): Whether to send a GUI notification. Default is True.
when (str | Pattern, optional): If provided, must match clipboard contents.
Acts as a gatekeeper: if there's no match, returns None and skips updating.
Returns:
str | None: The previous clipboard content, or None if `when` did not match.
Sample CLI
gway clip track-history
Signature
(interval: int = 5, *, stop_after=None, notify=True)
Docstring
Tracks clipboard history by polling at regular intervals.
Args:
interval (int): Seconds to wait between checks. Default is 5 seconds.
stop_after (int | None): Optional maximum duration (in seconds) before stopping.
notify (bool): Whether to show GUI notifications for new entries.
Writes:
Appends new clipboard entries to 'work/clip/history.txt', separated by '
...
'.
Signature
(subject, body=None, to=None, threaded=None, **kwargs)
Docstring
Send an email with the specified subject and body, using defaults from env if available.
Parameters:
- subject: the email subject (string)
- body: the plain-text body (string). Must be provided.
- to: recipient address (string). Defaults to ADMIN_EMAIL from the environment.
- threaded: if True, send the email asynchronously; if False, block and send; if None, auto-detect.
- **kwargs: reserved for future use.
Returns:
str ("Email sent successfully to ...") or error message, unless threaded is True (returns immediately).
Sample CLI
gway odoo execute-kw
Signature
(*args, model: str, method: str, **kwargs) -> dict
Docstring
A generic function to directly interface with Odoo's execute_kw method.
Parameters:
model (str): The Odoo model to interact with (e.g., 'sale.order').
method (str): The method to call on the model (e.g., 'read', 'write').
args (list): Positional arguments to pass to the method.
kwargs (dict): Keyword arguments to pass to the method.
Returns:
dict: The result of the execute_kw call.
Sample CLI
gway sql load-csv
Signature
(*, connection=None, folder='data', force=False)
Docstring
Recursively loads CSVs from a folder into SQLite tables.
Table names are derived from folder/file paths.
Sample CLI
gway sql open-connection
Signature
(datafile=None, *, sql_engine='sqlite', autoload=False, force=False, row_factory=False, **dbopts)
Docstring
Initialize or reuse a database connection.
Caches connections by sql_engine, file path, and thread ID (if required).
Starts writer thread for SQLite.
Sample CLI
gway ocpp.csms setup-app
References
cdv,
cdv.validate,
debug,
error,
exception,
info,
mail,
mail.send,
resolve,
resource,
unwrap_one,
warn Signature
(*, app=None, allowlist=None, denylist=None, location=None, authorize=<function authorize_balance at
0x00000256F2C3F1A0>, email=None)
Sample CLI
gway ocpp.sink setup-sink-app
Docstring
Basic OCPP passive sink for messages, acting as a dummy CSMS server.
This won't pass compliance or provide authentication. It just accepts and logs all.
Note: This version of the app was tested at the EVCS with real EVs.
Sample CLI
gway web.app debug-routes
Sample CLI
gway web.app setup
References
abort,
context,
debug,
info,
resource,
to_html,
to_json,
unwrap_one,
verbose,
version,
web,
web.auth,
web.auth.is_authorized,
web.error,
web.error.redirect,
web.error.unauthorized Signature
(*, app=None, project='web.site', path=None, home: str = None, views: str = 'view', apis: str =
'api', static='static', shared='shared', css='global', js='global', auth_required=False,
engine='bottle')
Docstring
Setup Bottle web application with symmetrical static/shared public folders.
Only one project per app. CSS/JS params are used as the only static includes.
Sample CLI
gway web.app template
Signature
(*args, **kwargs)
Docstring
Get a rendered template as a string iterator.
You can use a name, a filename or a template string as first parameter.
Template rendering arguments can be passed as dictionaries
or directly (as keyword arguments).
Sample CLI
gway web.error redirect
Signature
(message='', *, err=None, default=None, view_name=None)
Docstring
GWAY error/redirect handler.
Deprecated: 'view_name'. Now uses gw.web.app.current_endpoint.
Sample CLI
gway web.error unauthorized
Signature
(message='Unauthorized: You do not have access to this resource.', *, err=None, default=None)
Docstring
If in debug mode: show detailed error.
If not in debug: return a 401 Unauthorized and a WWW-Authenticate header to trigger the browser auth dialog.
Sample CLI
gway web.error view-debug-error
Signature
(*, title='GWAY Debug Error', message='An error occurred.', err=None, status=500, default=None)
Docstring
Render a debug error view with detailed traceback and request info.
Sample CLI
gway web.nav render
Docstring
Renders the sidebar navigation including search, home links, visited links, and a QR compass.
Sample CLI
gway web.server start-app
Signature
(*, host='[WEBSITE_HOST|127.0.0.1]', port='[WEBSITE_PORT|8888]', ws_port='[WEBSOCKET_PORT|9000]',
debug=False, proxy=None, app=None, daemon=True, threaded=True, is_worker=False, workers=None)
Docstring
Start an HTTP (WSGI) or ASGI server to host the given application.
- If `app` is a FastAPI instance, runs with Uvicorn (optionally on ws_port if set).
- If `app` is a WSGI app, uses Paste+ws4py or Bottle.
- If `app` is a zero-arg factory, it will be invoked (supporting sync or async factories).
- If `app` is a list of apps, each will be run in its own thread (each on an incremented port; FastAPI uses ws_port if set).
Sample CLI
gway run-recipe
Signature
(*script: str, **context)
Docstring
Run commands parsed from a .gwr file, falling back to the 'recipes/' resource bundle.
Recipes are gway scripts composed of one command per line with optional comments.
Signature
(*, root: str = 'tests', filter=None, project=None)
Docstring
Execute all automatically detected test suites, logging to logs/test.log.
TODOs
# TODO: Implement a 'project' mode. Instead of performing the hard-coded GWAY test
# suite, run an abstract test battery against the project or collection of projects