New tool: CLI Command Editor (#108)

What's CLI command editor?
In my day-to-day work, I have to use a lot of CLI commands. I often copy and paste them to my terminal and edited the command option values as required. Observing that many people face the similar issue, which can get tad bit annoying for complex commands, I have made this tool which easily lets you modify the option values.

How it works?
Paste the command.
A form will be presented with all the options and flags, you can edit this form.
Copy the command that gets generated in real-time as you edit it.
This commit is contained in:
TARS authored and GitHub committed 2025-07-06 19:02:51 +02:00
1 parent d625f622ca
commit 3b921e64ed
17 files changed
+387 -5

No files matched your search

@@ -0,0 +1,51 @@
<script setup lang="ts">
import * as service from './cli-command-editor.service';
const inputCommand = ref('');
const options = computed(() => service.extractOptions(inputCommand.value));
const optionsObject = computed(() => service.buildOptionsObject(options.value));
const optionsInput = ref<{ [k: string]: string }>(optionsObject.value);
const command = ref('');
</script>
<template>
<c-card>
<n-grid x-gap="12" y-gap="12" cols="1 600:3">
<n-gi span="2">
<c-input-text
v-model:value="inputCommand"
label-position="left"
label-width="130px"
:label="$t('tools.cli-command-editor.command')"
:aria-label="$t('tools.cli-command-editor.command')"
:placeholder="$t('tools.cli-command-editor.placeholder')"
:aria-placeholder="$t('tools.cli-command-editor.placeholder')"
raw-text
@update:value="() => { command = inputCommand }"
/>
<div v-for="option in options" :key="option" flex justify-center>
<c-input-text
v-model:value="optionsInput[option]"
label-position="left"
label-width="130px"
label-align="left"
:label="service.sanitizeOption(option)"
:aria-label="service.sanitizeOption(option)"
:placeholder="service.sanitizeOption(option)"
:aria-placeholder="service.sanitizeOption(option)"
mt-6
@update:value="() => { command = service.buildEditedCommand(optionsInput, optionsObject, inputCommand) }"
/>
</div>
<c-text-copyable
v-if="command"
:value="command"
:show-icon="false"
mt-6 font-mono
/>
</n-gi>
</n-grid>
</c-card>
</template>