disable colors in ci mode

This commit is contained in:
cupcakearmy 2020-11-16 17:30:32 +01:00
parent f6860115a3
commit 878a7bd752
No known key found for this signature in database
GPG Key ID: D28129AE5654D9D9
2 changed files with 9 additions and 6 deletions

View File

@ -1,3 +1,3 @@
## 0.24 ## 0.25
- Exit code on failure - disable color in CI mode

View File

@ -1,4 +1,4 @@
import 'colors' import colors from 'colors'
import { program } from 'commander' import { program } from 'commander'
import { setCIMode } from 'clitastic' import { setCIMode } from 'clitastic'
@ -17,7 +17,7 @@ import install from './handlers/install'
import { uninstall } from './handlers/uninstall' import { uninstall } from './handlers/uninstall'
import { upgrade } from './handlers/upgrade' import { upgrade } from './handlers/upgrade'
export const VERSION = '0.24' export const VERSION = '0.25'
export const INSTALL_DIR = '/usr/local/bin' export const INSTALL_DIR = '/usr/local/bin'
let requireConfig: boolean = true let requireConfig: boolean = true
@ -111,7 +111,9 @@ const { verbose, config: configFile, ci } = program.parse(process.argv)
export const VERBOSE = verbose export const VERBOSE = verbose
export let config: Config export let config: Config
setCIMode(ci) setCIMode(ci)
;(async () => { if (ci) colors.disable()
async function main() {
try { try {
const lock = readLock() const lock = readLock()
if (lock.running) throw new Error('An instance of autorestic is already running for this config file'.red) if (lock.running) throw new Error('An instance of autorestic is already running for this config file'.red)
@ -129,4 +131,5 @@ setCIMode(ci)
} finally { } finally {
unlock() unlock()
} }
})() }
main()