@cliz/cp
Version:
Online pbcopy + pbpaste
33 lines (32 loc) • 1.06 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const cli_1 = require("@cliz/cli");
const core_1 = require("../core");
const config_1 = require("../config");
const debug = require('debug')('cliz-cp');
exports.default = (0, cli_1.defineSubCommand)(createCommand => {
return createCommand('Pbcopy online')
.argument('[filepath]', 'File or diretory')
.option('-r, --relay <relay>', 'Use custom relay')
.action(async ({ args, options }) => {
const _options = {
...args,
...options,
};
const code = await (0, core_1.copy)(_options);
const cmd = `${config_1.default.name} paste ${code}`;
console.log([
`Code: ${code}`,
'',
`Command: ${cmd}`,
'',
].join('\n'));
try {
await cli_1.api.clipboard.copy(cmd);
console.log('Succeed to copy command.');
}
catch (error) {
console.log('Failed to copy command.');
}
});
});