quick test
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
import { Command, program } from "commander";
|
import { Command } from "commander";
|
||||||
import { SC_CONFIG } from "./config";
|
import { HOST } from "./host";
|
||||||
|
|
||||||
export function RUN_CLI(){
|
export function RUN_CLI(){
|
||||||
const c = new Command();
|
const c = new Command();
|
||||||
@@ -10,12 +10,13 @@ export function RUN_CLI(){
|
|||||||
|
|
||||||
c
|
c
|
||||||
.command('host <action>')
|
.command('host <action>')
|
||||||
.action((action, opts) => {
|
.action(async (action, opts) => {
|
||||||
console.log(opts)
|
console.log(opts)
|
||||||
switch(action){
|
switch(action){
|
||||||
|
|
||||||
case 'init':
|
case 'init':
|
||||||
console.log('init action!')
|
console.log('init action!')
|
||||||
|
console.log(`HOSTNAME: ${await HOST.getHostname()}`)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
import { $ } from "bun";
|
||||||
|
|
||||||
|
async function getHostname(){
|
||||||
|
const result = await $`hostname`.quiet().text();
|
||||||
|
return result.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
export const HOST = {
|
||||||
|
getHostname,
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user