From 27b6ea8e52684dd25c239b91dccee509481291a3 Mon Sep 17 00:00:00 2001 From: AkiraFukushima Date: Sun, 24 Jan 2021 19:01:34 +0900 Subject: [PATCH] refs #2024 Add help command for cli interface --- package.json | 1 + src/main/index.ts | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/package.json b/package.json index 37aeff15..d28fb2fe 100644 --- a/package.json +++ b/package.json @@ -182,6 +182,7 @@ "i18next": "^19.8.4", "lodash": "^4.17.20", "megalodon": "3.3.2", + "minimist": "^1.2.5", "moment": "^2.29.1", "mousetrap": "^1.6.5", "nedb": "^1.8.0", diff --git a/src/main/index.ts b/src/main/index.ts index 4b9ca520..6dd89cb9 100644 --- a/src/main/index.ts +++ b/src/main/index.ts @@ -28,6 +28,7 @@ import openAboutWindow from 'about-window' import { Entity, detector } from 'megalodon' import sanitizeHtml from 'sanitize-html' import AutoLaunch from 'auto-launch' +import minimist from 'minimist' import pkg from '~/package.json' import Authentication from './auth' @@ -365,6 +366,21 @@ async function createWindow() { } } +// Parse command line arguments and show help command. +const args = minimist(process.argv.slice(process.env.NODE_ENV === 'development' ? 2 : 1)) +if (args.help) { + console.log(` +Whalebird is Mastodon, Pleroma and Misskey client for desktop. + +Usage + $ whalebird + +Options + --help show help +`) + process.exit(0) +} + // Do not lower the rendering priority of Chromium when background app.commandLine.appendSwitch('disable-renderer-backgrounding')