From 13af25ef145155e4c1ae94018561a4aebb39b34e Mon Sep 17 00:00:00 2001 From: Morgan Metz <68765538+Morgandri1@users.noreply.github.com> Date: Sat, 6 Aug 2022 23:10:17 -0400 Subject: [PATCH] added credit to main thingy --- commands.ts | 157 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 157 insertions(+) create mode 100644 commands.ts diff --git a/commands.ts b/commands.ts new file mode 100644 index 0000000..b8782d8 --- /dev/null +++ b/commands.ts @@ -0,0 +1,157 @@ +// List of commands that do not require API calls + +import * as bin from './index'; +import config from '../../../config.json'; + +// Help +export const help = async (args: string[]): Promise => { + const commands = Object.keys(bin).sort().join(', '); + var c = ''; + for (let i = 1; i <= Object.keys(bin).sort().length; i++) { + if (i % 7 === 0) { + c += Object.keys(bin).sort()[i - 1] + '\n'; + } else { + c += Object.keys(bin).sort()[i - 1] + ' '; + } + } + return `Welcome! Here are all the available commands: +\n${c}\n +[tab]: trigger completion. +[ctrl+l]/clear: clear terminal.\n +Type 'sumfetch' to display summary. +`; +}; + +// Redirection +export const repo = async (args: string[]): Promise => { + window.open(`${config.repo}`); + return 'Opening Github repository...'; +}; + +// About +export const about = async (args: string[]): Promise => { + return `Hi, I am ${config.name}. +Welcome to my website! +More about me: +'sumfetch' - short summary. +'resume' - my latest resume. +'readme' - my github readme.`; +}; + +export const resume = async (args: string[]): Promise => { + window.open(`${config.resume_url}`); + return 'Opening resume...'; +}; + +// Donate +export const donate = async (args: string[]): Promise => { + return `thank you for your interest. +here are the ways you can support my work: +- paypal +- patreon +`; +}; + +// Contact +export const email = async (args: string[]): Promise => { + window.open(`mailto:${config.email}`); + return `Opening mailto:${config.email}...`; +}; + +export const github = async (args: string[]): Promise => { + window.open(`https://github.com/${config.social.github}/`); + + return 'Opening github...'; +}; + +export const linkedin = async (args: string[]): Promise => { + window.open(`https://www.linkedin.com/in/${config.social.linkedin}/`); + + return 'Opening linkedin...'; +}; + +// Search +export const google = async (args: string[]): Promise => { + window.open(`https://google.com/search?q=${args.join(' ')}`); + return `Searching google for ${args.join(' ')}...`; +}; + +export const duckduckgo = async (args: string[]): Promise => { + window.open(`https://duckduckgo.com/?q=${args.join(' ')}`); + return `Searching duckduckgo for ${args.join(' ')}...`; +}; + +export const bing = async (args: string[]): Promise => { + window.open(`https://bing.com/search?q=${args.join(' ')}`); + return `Wow, really? You are using bing for ${args.join(' ')}?`; +}; + +export const reddit = async (args: string[]): Promise => { + window.open(`https://www.reddit.com/search/?q=${args.join(' ')}`); + return `Searching reddit for ${args.join(' ')}...`; +}; + +// Typical linux commands +export const echo = async (args: string[]): Promise => { + return args.join(' '); +}; + +export const whoami = async (args: string[]): Promise => { + return `${config.ps1_username}`; +}; + +export const ls = async (args: string[]): Promise => { + return `a +bunch +of +fake +directories`; +}; + +export const cd = async (args: string[]): Promise => { + return `unfortunately, i cannot afford more directories. +if you want to help, you can type 'donate'.`; +}; + +export const date = async (args: string[]): Promise => { + return new Date().toString(); +}; + +export const vi = async (args: string[]): Promise => { + return `woah, you still use 'vi'? just try 'vim'.`; +}; + +export const vim = async (args: string[]): Promise => { + return `'vim' is so outdated. how about 'nvim'?`; +}; + +export const nvim = async (args: string[]): Promise => { + return `'nvim'? too fancy. why not 'emacs'?`; +}; + +export const emacs = async (args?: string[]): Promise => { + return `you know what? just use vscode.`; +}; + +export const sudo = async (args?: string[]): Promise => { + window.open('https://www.youtube.com/watch?v=dQw4w9WgXcQ', '_blank'); // ...I'm sorry + return `Permission denied: with little power comes... no responsibility? `; +}; + +// Banner +export const banner = (args?: string[]): string => { + return ` +█████ ███ ███████████ +░░███ ░░░ ░█░░░███░░░█ + ░███ ████ █████ █████ ██████ ░ ░███ ░ ██████ ████████ █████████████ + ░███ ░░███ ░░███ ░░███ ███░░███ ░███ ███░░███░░███░░███░░███░░███░░███ + ░███ ░███ ░███ ░███ ░███████ ░███ ░███████ ░███ ░░░ ░███ ░███ ░███ + ░███ █ ░███ ░░███ ███ ░███░░░ ░███ ░███░░░ ░███ ░███ ░███ ░███ + ███████████ █████ ░░█████ ░░██████ █████ ░░██████ █████ █████░███ █████ +░░░░░░░░░░░ ░░░░░ ░░░░░ ░░░░░░ ░░░░░ ░░░░░░ ░░░░░ ░░░░░ ░░░ ░░░░░ + +Type 'help' to see the list of available commands. +Type 'sumfetch' to display summary. +Type 'repo' or click here for the Github repository. +`; +};