32 lines
850 B
TypeScript
32 lines
850 B
TypeScript
import { Command } from '@effect/cli';
|
|
import { BunContext, BunRuntime } from '@effect/platform-bun';
|
|
import { Effect } from 'effect';
|
|
import pkg from '../package.json' with { type: 'json' };
|
|
|
|
const diffCommand = Command.make('diff', {}, () =>
|
|
Effect.gen(function* () {
|
|
yield* Effect.log('diff');
|
|
yield* Effect.log('diff2');
|
|
}),
|
|
);
|
|
|
|
const applyCommand = Command.make('apply', {}, () =>
|
|
Effect.gen(function* () {
|
|
yield* Effect.log('apply');
|
|
yield* Effect.log('apply2');
|
|
}),
|
|
);
|
|
|
|
const cliName = 'winos-config';
|
|
|
|
const app = Command.make(cliName, {}).pipe(
|
|
Command.withDescription('NixOS-like tool for windows'),
|
|
Command.withSubcommands([diffCommand, applyCommand]),
|
|
);
|
|
|
|
const cli = Command.run(app, {
|
|
name: cliName,
|
|
version: pkg.version,
|
|
});
|
|
cli(process.argv).pipe(Effect.provide(BunContext.layer), BunRuntime.runMain);
|