UNPKG

gitsu-cli

Version:

Interactive command line util for quickly & easily switching git users

31 lines (27 loc) 842 B
import chalk from 'chalk'; import logSymbols from 'log-symbols'; import getCurrentChoice from '../functions/get-current-choice'; import type { IUser } from '../types'; import { formatChoice } from '../utils/choice'; import getConfig from '../utils/get-config'; export default async () => { try { const configResult = await getConfig(); const users = configResult.config; const currentChoice = await getCurrentChoice(); users.map((user: IUser) => { if (currentChoice === formatChoice(user)) { console.log(`${logSymbols.success} ${formatChoice(user)}`); } else { console.log(` ${chalk.grey(formatChoice(user))}`); } }); } catch (error) { console.log( `${logSymbols.error} ${chalk.red( 'Failed to list configured gitsu users', )}`, error, ); } };