Skip to content

Commit

Permalink
Cli: usage
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanjermakov committed Jun 4, 2023
1 parent c7ed368 commit a97ae8e
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,19 @@ import { compactToken, flattenToken, parse } from './parser/parser'
import { tokenize } from './lexer/lexer'
import { inspect } from 'util'
import { readFileSync } from 'fs'
import { resolve } from 'path'
import { join, resolve } from 'path'

const version = JSON.parse(readFileSync(join(__dirname, '..', 'package.json')).toString()).version

export const usage = `\
Nois transpiler - v${version}
Usage: nois file`

const path = process.argv.slice(2).at(0)
if (!path) {
throw Error('no file provided')
console.log(usage)
process.exit()
}

const code = readFileSync(resolve(path)).toString()
Expand Down

0 comments on commit a97ae8e

Please sign in to comment.