|
@ -1,7 +1,8 @@ |
|
|
#!/usr/bin/env node
|
|
|
#!/usr/bin/env node
|
|
|
|
|
|
|
|
|
import program from 'commander'; |
|
|
import program from 'commander'; |
|
|
import { readFileSync } from 'fs'; |
|
|
import { readFile } from 'fs-promise'; |
|
|
|
|
|
import getStdin from 'get-stdin'; |
|
|
import { version } from '../package.json'; |
|
|
import { version } from '../package.json'; |
|
|
import htconvert from './htconvert'; |
|
|
import htconvert from './htconvert'; |
|
|
|
|
|
|
|
@ -10,6 +11,6 @@ program |
|
|
.option('-f, --file [.htaccess]', 'File containing .htaccess redirects') |
|
|
.option('-f, --file [.htaccess]', 'File containing .htaccess redirects') |
|
|
.parse(process.argv); |
|
|
.parse(process.argv); |
|
|
|
|
|
|
|
|
const htaccessRules = readFileSync(program.file, 'utf-8'); |
|
|
const readHtaccess = program.file ? readFile(program.file, 'utf-8') : getStdin(); |
|
|
const nginxRules = htconvert(htaccessRules); |
|
|
|
|
|
console.log(nginxRules); |
|
|
readHtaccess.then(htconvert).then(console.log); |
|
|