2019-09-12 23:48:44 +03:00
|
|
|
/**
|
|
|
|
* Parse action input into a some proper thing.
|
|
|
|
*/
|
|
|
|
|
2019-09-25 10:08:33 +03:00
|
|
|
import {input} from '@actions-rs/core';
|
2019-09-12 23:48:44 +03:00
|
|
|
|
2019-09-13 22:45:36 +03:00
|
|
|
import stringArgv from 'string-argv';
|
|
|
|
|
2019-09-12 23:48:44 +03:00
|
|
|
// Parsed action input
|
|
|
|
export interface Input {
|
|
|
|
command: string,
|
|
|
|
toolchain?: string,
|
|
|
|
args: string[],
|
|
|
|
useCross: boolean,
|
|
|
|
}
|
|
|
|
|
2019-09-25 10:08:33 +03:00
|
|
|
export function get(): Input {
|
|
|
|
const command = input.getInput('command', {required: true});
|
|
|
|
const args = stringArgv(input.getInput('args'));
|
|
|
|
let toolchain = input.getInput('toolchain');
|
2019-09-12 23:48:44 +03:00
|
|
|
if (toolchain.startsWith('+')) {
|
|
|
|
toolchain = toolchain.slice(1);
|
|
|
|
}
|
2019-09-25 10:08:33 +03:00
|
|
|
const useCross = input.getInputBool('use-cross');
|
2019-09-12 23:48:44 +03:00
|
|
|
|
|
|
|
return {
|
|
|
|
command: command,
|
|
|
|
args: args,
|
|
|
|
useCross: useCross,
|
|
|
|
toolchain: toolchain || undefined
|
|
|
|
}
|
|
|
|
}
|