xonsh / xontrib-template

Full-featured template for building extension (xontrib) for the xonsh shell.
MIT License
44 stars 12 forks source link

Idea: xontrib-ask - command template with interactive sections #29

Open anki-code opened 1 year ago

anki-code commented 1 year ago

Hello! I have an idea!

The ability to create command template. Before executing the command the placeholders should be filled interactively.

First step - Ask to input argument and with autocomplete:

echo I am saying @(ask('What to say'))
# What to say: hello
# I am saying hello

echo Give @(ask('Fruit', ['apple', 'banana', 'orange'])) to @(ask('To', [$(whoami).strip()]))
# Fruit: <Tab>
# Fruit: apple
# To: <Tab>
# To: user
# Give apple to user

For community

⬇️ Please click the 👍 reaction instead of leaving a +1 or 👍 comment