cli_wrapper-example.genai.js•981 B
script({
title: "CLI Wrapper with Timeout and Type Annotations",
description: "Generate a Python wrapper function to call a CLI tool.",
system: ["system", "system.files", "system.python"]
})
def("CLI", env.files)
$`# Python CLI Wrapper
This script will generate a Python wrapper function to call a CLI tool.
The wrapper will include Pylance type annotations and handle optional arguments for each CLI option. Document each option.
Additionally, the script will implement a timeout mechanism for the CLI invocation.
## Requirements
- Python 3.x
- subprocess module
- typing module (for type annotations)
- use a class to wrap functions
- function name should match command name
- generate wrappers for ALL commands and you shall be rewarded with a cookie
## Usage
To use the generated wrapper, import the module and call the function with the appropriate arguments.
The function will return the CLI output or raise an exception if the CLI call fails or times out.
`