Skip to content

Commit

Permalink
fix: remove executable option due to path issues
Browse files Browse the repository at this point in the history
  • Loading branch information
runreal-warman committed Apr 4, 2024
1 parent 625c510 commit 727e3fc
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 29 deletions.
10 changes: 4 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,19 +92,17 @@ Options:
Usage: runtrigger add <script>
Description:
add a trigger
Options:
-e, --executable - setup the trigger as an executable
-d, --deno-binary <deno> - path to the deno binary if not using executable (Default: "deno")
Options:
-d, --deno-binary <deno> - override path to the deno binary (Default: "Deno.execPath()")
```

### `update`
```
Usage: runtrigger update <script>
Description:
update a trigger
Options:
-e, --executable - setup the trigger as an executable
-d, --deno-binary <deno> - path to the deno binary if not using executable (Default: "deno")
Options:
-d, --deno-binary <deno> - override path to the deno binary (Default: "Deno.execPath()")
```

### `rm`
Expand Down
35 changes: 12 additions & 23 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,8 @@ await new Command()
})
.command('add', 'add a trigger')
.arguments('<script:file>')
.option('-e, --executable', 'setup the trigger as an executable')
.option('-d, --deno-binary <deno:file>', 'path to the deno binary if not using executable', { default: 'deno' })
.action(async ({ executable, denoBinary }, script) => {
.option('-d, --deno-binary <deno:file>', 'override path to the deno binary', { default: 'Deno.execPath()' })
.action(async ({ denoBinary }, script) => {
if (script.startsWith('file://')) {
script = import.meta.resolve(script)
} else {
Expand All @@ -45,15 +44,10 @@ await new Command()
const cmd = await p4.runCommandZ(`triggers`, ['-o'])
const triggers = p4.parseTriggersOutput(cmd.output)

let triggerCommand = ''
if (executable) {
triggerCommand = `runtrigger exec ${script} ${config.args.join(' ')}`
} else {
// We want to run this cli as the entry point
const cliPath = path.fromFileUrl(import.meta.url)
triggerCommand = `${denoBinary} run -A ${cliPath} exec ${script} ${config.args.join(' ')}`
}

// We want to run this cli as the entry point
const cliPath = path.fromFileUrl(import.meta.url)
const triggerCommand = `${denoBinary} run -A ${cliPath} exec ${script} ${config.args.join(' ')}`

// Create a trigger for each type and path
const newTriggers: P4Trigger[] = []
config.type.map((type) => {
Expand All @@ -75,9 +69,8 @@ await new Command()
})
.command('update', 'update a trigger')
.arguments('<script:string>')
.option('-e, --executable', 'setup the trigger as an executable')
.option('-d, --deno-binary <deno:file>', 'path to the deno binary if not using executable', { default: 'deno' })
.action(async ({ executable, denoBinary }, script) => {
.option('-d, --deno-binary <deno:file>', 'override path to the deno binary', { default: 'deno' })
.action(async ({ denoBinary }, script) => {
if (script.startsWith('file://')) {
script = import.meta.resolve(script)
} else {
Expand All @@ -94,14 +87,10 @@ await new Command()
return
}

let triggerCommand = ''
if (executable) {
triggerCommand = `runtrigger exec ${script} ${config.args.join(' ')}`
} else {
// We want to run this cli as the entry point
const cliPath = path.fromFileUrl(import.meta.url)
triggerCommand = `${denoBinary} run -A ${cliPath} exec ${script} ${config.args.join(' ')}`
}
// We want to run this cli as the entry point
const cliPath = path.fromFileUrl(import.meta.url)
const triggerCommand = `${denoBinary} run -A ${cliPath} exec ${script} ${config.args.join(' ')}`

// Create a trigger for each type and path
const newTriggers: P4Trigger[] = []
config.type.map((type) => {
Expand Down

0 comments on commit 727e3fc

Please sign in to comment.