feat: platform-specific paste hints

This commit is contained in:
SealsRock12 2020-12-16 10:13:16 -08:00
parent 8e6992ab27
commit 1159f0cb99
No known key found for this signature in database
GPG Key ID: 96C0E58F6B6174BE
2 changed files with 7775 additions and 5247 deletions

13010
dist/main.js vendored

File diff suppressed because it is too large Load Diff

View File

@ -13,6 +13,7 @@ import i18n from './i18n'
const inquirer: typeof import('inquirer') = require('inquirer')
const ora: typeof import('ora') = require('ora')
const chalk: typeof import('chalk') = require('chalk')
const os: typeof import('os') = require('os');
const SCORE_URL_PREFIX = 'https://(s.)musescore.com/'
const SCORE_URL_REG = /https:\/\/(s\.)?musescore\.com\//
@ -27,6 +28,15 @@ interface Params {
}
void (async () => {
// Determine platform and paste message
const platform = os.platform();
let pasteMessage = '';
if (platform === 'win32') {
pasteMessage = 'right-click to paste';
} else if (platform === 'linux') {
pasteMessage = 'usually Ctrl+Shift+V to paste';
}
let scoreinfo: ScoreInfo
// ask for the page url or path to local file
const { fileInit } = await inquirer.prompt<Params>({
@ -35,7 +45,7 @@ void (async () => {
message: 'Score URL or path to local MSCZ file:',
suffix: '\n ' +
`(starts with "${SCORE_URL_PREFIX}" or local filepath ends with "${EXT}") ` +
`${chalk.bgGray`right-click to paste`}\n `,
`${chalk.bgGray(pasteMessage)}\n `,
validate (input: string) {
return input &&
(