UNPKG

alia

Version:
39 lines (38 loc) 907 B
import { Flag } from './flag.js'; export class SyncFlag extends Flag { flag = { key: 'sync', short: 'sy', desc: 'backup/restore config from gist (default: restore)', run: (args, _) => this.sync(args) }; mods = [ { key: 'backup', short: 'b', desc: 'backup your current config', run: () => this.backup() }, { key: 'restore', short: 'r', desc: 'restore latest config from gist', run: () => this.restore() } ]; async sync(args) { if (args.length) { return true; } await this.restore(); return true; } async restore() { await this.gistService.restore(); return true; } async backup() { await this.gistService.backup(); return true; } }