-
Notifications
You must be signed in to change notification settings - Fork 121
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: copy minimal feature set from ./bin/tact
- Loading branch information
Showing
2 changed files
with
48 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} | ||
} |