Skip to content

Commit

Permalink
Merge pull request #76 from jskorepa/master
Browse files Browse the repository at this point in the history
Add --noHeader switch
  • Loading branch information
crispmark authored Jan 5, 2018
2 parents e8eb20b + a027631 commit 518a720
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions bin/schemats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ interface SchematsConfig {
schema: string,
output: string,
camelCase: boolean,
noHeader: boolean,
}

let argv: SchematsConfig = yargs
Expand All @@ -25,7 +26,7 @@ let argv: SchematsConfig = yargs
.env('SCHEMATS')
.command('generate', 'generate type definition')
.demand(1)
// tslint:disable-next-line
// tslint:disable-next-line
.example('$0 generate -c postgres://username:password@localhost/db -t table1 -t table2 -s schema -o interface_output.ts', 'generate typescript interfaces from schema')
.demand('c')
.alias('c', 'conn')
Expand All @@ -39,6 +40,7 @@ let argv: SchematsConfig = yargs
.describe('s', 'schema name')
.alias('C', 'camelCase')
.describe('C', 'Camel-case columns')
.describe('noHeader', 'Do not write header')
.demand('o')
.nargs('o', 1)
.alias('o', 'output')
Expand All @@ -59,7 +61,7 @@ let argv: SchematsConfig = yargs
}

let formattedOutput = await typescriptOfSchema(
argv.conn, argv.table, argv.schema, { camelCase: argv.camelCase })
argv.conn, argv.table, argv.schema, { camelCase: argv.camelCase, writeHeader: !argv.noHeader })
fs.writeFileSync(argv.output, formattedOutput)

} catch (e) {
Expand Down

0 comments on commit 518a720

Please sign in to comment.