Skip to content

Commit c07b8fd

Browse files
authored
Merge pull request #8 from juliangruber/add/print
add `--print` mode
2 parents 49701bf + 51275b3 commit c07b8fd

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

README.md

+9
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,15 @@ yolox "extract audio from maths.mp4 and save it as maths.m4a" --model=llama
9292
# ffmpeg -i maths.mp4 -vn -acodec copy maths.m4a
9393
```
9494

95+
### Print mode
96+
97+
Print the command but don't execute it:
98+
99+
```console
100+
yolox --print "extract audio from maths.mp4 and save it as maths.m4a"
101+
ffmpeg -i maths.mp4 -vn -acodec copy maths.m4a
102+
```
103+
95104
## Alternatives
96105

97106
[GitHub Copilot CLI](https://docs.github.com/en/copilot/github-copilot-in-the-cli/using-github-copilot-in-the-cli) is a paid offering from GitHub that works similarly to yolox, but is safer. Rather than running the generated command, it shows you the command and gives you some options:

index.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,12 @@ import { readFile } from 'node:fs/promises'
88
import { existsSync } from 'node:fs'
99
import { resolve } from 'node:path'
1010

11-
const argv = minimist(process.argv.slice(2))
11+
const argv = minimist(process.argv.slice(2), {
12+
boolean: ['print']
13+
})
1214
let englishCommand = argv._.join(' ')
1315
const model = argv.model || 'gpt-4o'
16+
const printMode = argv.print || false
1417

1518
const models = {
1619
llama: 'replicate:meta/meta-llama-3.1-405b-instruct',
@@ -81,6 +84,10 @@ const shellCommand = output.join('')
8184
console.log(`Command: ${shellCommand}`)
8285
console.log('')
8386

87+
if (printMode) {
88+
process.exit()
89+
}
90+
8491
const child = spawn(shellCommand, { shell: true })
8592

8693
child.stdout.on('data', (data) => {

0 commit comments

Comments
 (0)