mirror of
https://github.com/cupcakearmy/autorestic.git
synced 2024-12-22 08:16:25 +00:00
small bugs
This commit is contained in:
parent
993fe072e2
commit
e47d6be854
@ -1,13 +1,10 @@
|
|||||||
import 'colors'
|
import 'colors'
|
||||||
import minimist from 'minimist'
|
import minimist from 'minimist'
|
||||||
import { homedir } from 'os'
|
|
||||||
import { resolve } from 'path'
|
|
||||||
|
|
||||||
import { init } from './config'
|
import { init } from './config'
|
||||||
import handlers, { error, help } from './handlers'
|
import handlers, { error, help } from './handlers'
|
||||||
import { Config } from './types'
|
import { Config } from './types'
|
||||||
|
|
||||||
|
|
||||||
process.on('uncaughtException', err => {
|
process.on('uncaughtException', err => {
|
||||||
console.log(err.message)
|
console.log(err.message)
|
||||||
process.exit(1)
|
process.exit(1)
|
||||||
@ -15,32 +12,30 @@ process.on('uncaughtException', err => {
|
|||||||
|
|
||||||
export const { _: commands, ...flags } = minimist(process.argv.slice(2), {
|
export const { _: commands, ...flags } = minimist(process.argv.slice(2), {
|
||||||
alias: {
|
alias: {
|
||||||
'c': 'config',
|
c: 'config',
|
||||||
'v': 'verbose',
|
v: 'version',
|
||||||
'h': 'help',
|
h: 'help',
|
||||||
'a': 'all',
|
a: 'all',
|
||||||
'l': 'location',
|
l: 'location',
|
||||||
'b': 'backend',
|
b: 'backend',
|
||||||
},
|
},
|
||||||
boolean: ['a'],
|
boolean: ['a'],
|
||||||
string: ['l', 'b'],
|
string: ['l', 'b'],
|
||||||
})
|
})
|
||||||
|
|
||||||
export const VERSION = '0.4'
|
export const VERSION = '0.7'
|
||||||
export const DEFAULT_CONFIG = '/.autorestic.yml'
|
|
||||||
export const INSTALL_DIR = '/usr/local/bin'
|
export const INSTALL_DIR = '/usr/local/bin'
|
||||||
export const CONFIG_FILE: string = resolve(flags.config || homedir() + DEFAULT_CONFIG)
|
|
||||||
export const VERBOSE = flags.verbose
|
export const VERBOSE = flags.verbose
|
||||||
|
|
||||||
|
if (flags.version) {
|
||||||
|
console.log('version'.grey, VERSION)
|
||||||
|
process.exit(0)
|
||||||
|
}
|
||||||
|
|
||||||
export const config: Config = init()
|
export const config: Config = init()
|
||||||
|
|
||||||
function main() {
|
function main() {
|
||||||
if (flags.version)
|
if (commands.length < 1) return help()
|
||||||
return console.log('version'.grey, VERSION)
|
|
||||||
|
|
||||||
if (commands.length < 1)
|
|
||||||
return help()
|
|
||||||
|
|
||||||
|
|
||||||
const command: string = commands[0]
|
const command: string = commands[0]
|
||||||
const args: string[] = commands.slice(1)
|
const args: string[] = commands.slice(1)
|
||||||
|
Loading…
Reference in New Issue
Block a user