An interactive command-line interface (CLI) tool to help you install, use, and administer an AO instance.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

38 lines
1.8 KiB

import chalk from 'chalk'
import chalkAnimation from 'chalk-animation'
import gradient from 'gradient-string'
import figlet from 'figlet'
import { createSpinner } from 'nanospinner'
import { sleep } from './util.js'
import { selectRandom } from './util.js'
import { centerLines } from './strings.js'
// Displays a brief randomly-selected rainbow-animated phrase
const greetingMessages = ['Portaling!', 'You are a Unicorn!', "Here we go!", "Wow!", "AO Loading...", "Powering Up!", "Unicorn Portal", "Don't Panic!"]
export async function unicornPortal(ms) {
const randomGreetingMessage = selectRandom(greetingMessages)
const rainbowTitle = chalkAnimation.rainbow(randomGreetingMessage + '\n')
await sleep(ms)
rainbowTitle.stop()
}
// Prints the given message to the screen in the given ASCII art style. Here is a list of decent styles:
const asciiFonts = ['Standard', 'Digital', 'Bubble', 'Script', 'Mini', 'Banner', 'Alphabet', 'Avatar', 'Chunky', 'Computer', 'Contessa', 'Gothic', 'Invita', 'Lockergnome', 'Madrid', 'Morse', 'Moscow', 'Pawp', 'Pepper', 'Pyramid', 'Rectangles', 'Shadow', 'Short', 'Slant', 'Small', 'Stampatello', 'Stop', 'Straight', 'Thick', 'Thin', 'Weird']
export async function asciiArt(message, style) {
const randomFont = selectRandom(asciiFonts)
let art = figlet.textSync(message || 'Autonomous Organization', { font: randomFont })
art = centerLines(art)
console.log(gradient.pastel.multiline(art))
}
// Clears the console
export function clearScreen() {
console.clear()
}
// Displays a spinner for 1.2 secconds with the given messages during and after the timer completes
export async function spinnerWait(waitingMessage, doneMessage, ms = 1200) {
const spinner = createSpinner(waitingMessage || 'Please wait...').start()
await sleep(ms)
spinner.success({ text: doneMessage || 'Done.' })
}