@cliz/gpm
Version:
Git Project Manager
47 lines (46 loc) • 1.43 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const cli_1 = require("@cliz/cli");
const core_1 = require("@cliz/web-terminal/lib/core");
/**
* example:
* server:
* using link: gpm share terminal
* use code: gpm share terminal --disable-link
*
* client:
* using link: open url in browser
* use code: gpm share terminal --client -c <code>
*/
exports.default = (0, cli_1.defineSubCommand)((createCommand) => {
return createCommand('Share terminal')
.option('-c, --code <code>', 'Use custom code', {
default: process.env.CODE,
})
.option('-r, --relay <relay>', 'Use custom relay', {
default: process.env.REPLAY || 'wss://web-terminal.zcorky.com/terminal',
})
.option('--disable-link', 'Disable link', {
default: false,
})
.option('--client', 'Set as client, default: false', {
default: false,
})
.option('--verbose', 'Show Command Log')
.action(({ args, options }) => {
let useLink = true;
let isClient = !!options.client;
if (!!options.disableLink) {
useLink = false;
}
const _options = {
...args,
...options,
useLink,
};
if (!!isClient) {
return (0, core_1.startClient)(_options);
}
return (0, core_1.startServer)(_options);
});
});