Open devraj opened 1 month ago
For reference, Typer will allow you quite easily do this for arguments
, to achieve the following:
gala alarm process 2299 2200 2202
you can define the signature as:
from typing import Optional, List
from typing_extensions import Annotated
import typer
app = AsyncTyper(
help="List, query, follow, act on alarms in the command centre"
)
@app.command("ack")
async def acknowledge(
ids: Annotated[List[int], typer.Argument(help="alarm id")], #multiple ids
message: Annotated[
Optional[str],
typer.Option(
"-m",
"--message",
help="comment to add to history",
),
] = None,
):
for id in ids:
print(id)
where
ids: Annotated[List[int], typer.Argument(help="alarm id")], #multiple ids
will always result in a list and thus you must iterate over it.
Is your feature request related to a problem? Please describe. The idea came to me when I was doing some support work for my own command centre where while configuring a 7000 controller I had a series of
Invalid certificate
alarms for the controller purely from having to reset it.While it's absolutely legitimate that the user interface requires a user to acknowledge each alarm on its own (signifying that the user has actually looked at the alarm or event).
It occurred to me that it would be handy to batch process these events and alarms through a power tool like the
cli
or thetui
for that matter.Describe the solution you'd like This solution requires no modification to the SDK per say as each event or alarm would still have to be processed one at a time i.e multiple REST calls.
The command line on the other hand would provide the options such as:
gala alarm process 2230 2231 -m "message"
gala alarm process 2200-2210 -m "message"
for the CLI to process those range of alarms of events.
I would expect the CLI tool to:
--confirm
style argument for non interactive executionDescribe alternatives you've considered You could use
--json
output and then pipe this through thecli
via bash?Additional context Standard Unix commands would provide multiple values by
grep -e pattern1 -e pattern2 file.txt
ls file1.txt file2.txt file3.txt