Cloving Generate Shell Command Documentation

Learn how to use the cloving generate shell command to generate and manage shell scripts.

Usage

cloving generate shell [options]

There is also shortcut to save you a few chars

cloving g sh [options]

Description

The cloving generate shell command helps you generate executable shell scripts based on a prompt. It uses the AI APIs configured with cloving config and the prompt and generate relevant shell commands, which can then be reviewed, revised, executed, or copied to the clipboard.

Options

This command accepts the following options:

  • -s, --silent: Run the command without asking for confirmation of submitting prompts.
  • -m, --model <model>: Select the model to use (e.g., openai, claude, ollama, ollama:llama3, claude:claude-3-5-sonnet-20240620).
  • -p, --prompt <prompt>: Specify the prompt to use.

Interactive Prompts

The cloving generate shell command uses the following interactive prompts:

  • Shell prompt: Prompt to provide a description of the shell script to be generated.
  • Action selection: Prompt to select an action to perform with the generated shell script (e.g., execute, revise, explain, copy to clipboard, cancel).
  • Revise prompt: Prompt to revise the generated shell script and provide a new description.
  • Explain prompt: Prompt to explain how the generated shell script works.

Example Process

Example Shell Script Generation Session

Here is an example of what a shell script generation session might look like:

$ cloving generate shell -p "List all TypeScript files in the current directory"
Generating shell script...

Generated shell script:
\`\`\`sh
find . -type f -name "*.ts"
\`\`\`

What would you like to do?
1. Execute
2. Revise
3. Explain
4. Copy to Clipboard
5. Cancel

If you choose to execute the script, the process continues as follows:

$ cloving generate  shell -p "List all TypeScript files in the current directory"
Generating shell script...

Generated shell script:
\`\`\`sh
find . -type f -name "*.ts"
\`\`\`

What would you like to do?
1. Execute
2. Revise
3. Explain
4. Copy to Clipboard
5. Cancel
> Execute

./src/index.ts
./src/utils/config_utils.ts
./src/utils/git_utils.ts
./src/utils/string_utils.ts
./src/utils/types.ts
./src/commands/config.ts
./src/commands/init.ts
...