Skip to content

Commit

Permalink
feat: copy minimal feature set from ./bin/tact
Browse files Browse the repository at this point in the history
  • Loading branch information
vitorpy committed Apr 23, 2024
1 parent 2312df9 commit 4dd0381
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 3 deletions.
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,9 @@
},
"oclif": {
"bin": "tact",
"commands": "./dist/commands",
"dirname": "tact",
"topicSeparator": " "
"commands": {
"strategy": "single",
"target": "./dist/src/cli"
}
}
}
44 changes: 44 additions & 0 deletions src/cli.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import { Args, Command, Flags } from "@oclif/core";
import { run } from "./node";
import { version } from '../package.json';

export class TactCli extends Command {
static description = "Tact compiler.";

static args = {
config: Args.string({ required: false }),
};

static flags = {
version: Flags.boolean(),
project: Flags.string(),
};

async run(): Promise<void> {
const { args, flags } = await this.parse(TactCli);

if (flags.version) {
this.log(`Tact compiler v${version}`);
this.exit(0);
}

if (!args.config) {
this.error("Config file is required.");
}

try {
const success = await run({
configPath: args.config,
projectNames: flags.project ? [flags.project] : [],
});

if (!success) this.exit(30);
} catch (e) {
this.warn(
"Internal compiler error. Please, report it to https://github.com/tact-lang/tact/issues.",
);
this.log(e as string);
this.exit(30);
}
}
}

0 comments on commit 4dd0381

Please sign in to comment.