From 312c676d78bc304a18c9b9979ff2986df2cf8d51 Mon Sep 17 00:00:00 2001 From: Rafa Mel Date: Fri, 26 Apr 2019 03:16:53 +0200 Subject: [PATCH] feat(exposed): adds silent --- src/exposed/index.ts | 1 + src/exposed/silent.ts | 14 ++++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 src/exposed/silent.ts diff --git a/src/exposed/index.ts b/src/exposed/index.ts index 8dab522..22419d3 100644 --- a/src/exposed/index.ts +++ b/src/exposed/index.ts @@ -1,3 +1,4 @@ export { default as options } from './options'; export { default as series } from './series'; +export { default as silent } from './silent'; export { default as line } from './line'; diff --git a/src/exposed/silent.ts b/src/exposed/silent.ts new file mode 100644 index 0000000..c3cce1e --- /dev/null +++ b/src/exposed/silent.ts @@ -0,0 +1,14 @@ +import { TScript } from '~/types'; +import core from '~/core'; +import logger from '~/utils/logger'; + +// eslint-disable-next-line @typescript-eslint/explicit-function-return-type +export default function silent(script: TScript) { + return async function silent(args?: string[]): Promise { + try { + await core.run(script, args || []); + } catch (err) { + logger.error(err); + } + }; +}