-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
45 additions
and
10,096 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
npm run transmute -- jose key generate --alg ES256 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import * as core from '@actions/core' | ||
|
||
import { parseArgs } from "node:util"; | ||
|
||
// https://stackoverflow.com/questions/29655760/convert-a-string-into-shell-arguments | ||
const re = /"[^"]+"|'[^']+'|\S+/g | ||
|
||
// prefer to parse options deeper | ||
const options = { | ||
foo: { | ||
type: 'boolean' as "string" | "boolean", | ||
short: 'f', | ||
}, | ||
alg: { | ||
type: 'string' as "string" | "boolean", | ||
}, | ||
}; | ||
|
||
export async function facade(prompt: string = process.argv.slice(2).join(' ')) { | ||
try { | ||
if (process.env.GITHUB_ACTION) { | ||
prompt = core.getInput("transmute") | ||
} | ||
const promptArgs = prompt.match(re) || [] | ||
const parsed = parseArgs({ args: promptArgs, options, allowPositionals: true }); | ||
console.log(parsed) | ||
} catch (error) { | ||
core.setFailed('💀 Internal Error.') | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,5 @@ | ||
#!/usr/bin/env node | ||
|
||
import * as core from '@actions/core' | ||
import { facade } from "./facade" | ||
|
||
import cli from '../cli' | ||
|
||
async function run() { | ||
if (process.env.GITHUB_ACTION) { | ||
try { | ||
console.warn('todo github action') | ||
} catch (error) { | ||
core.setFailed((error as Error).message) | ||
} | ||
} else { | ||
await cli.init() | ||
} | ||
} | ||
|
||
run() | ||
facade() |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
const cli = {} | ||
import { facade } from './action/facade' | ||
|
||
const cli = { facade } | ||
|
||
export default cli |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
import cli from '../src' | ||
|
||
it('src exports cli', () => { | ||
expect(cli).toBeDefined() | ||
it('cli exports facade', async () => { | ||
await cli.facade(` | ||
jose key generate --alg ES256 | ||
`) | ||
}) |