Add package-upgrade notice and --version

This commit is contained in:
Nemo 2021-07-29 11:44:23 +05:30
parent 2eadb53b8f
commit 30effce43b
4 changed files with 1448 additions and 57 deletions

View File

@ -5,12 +5,18 @@ import { parse } from "./src/parser.js";
import { generate } from "./src/cue.js"; import { generate } from "./src/cue.js";
import minimist from "minimist"; import minimist from "minimist";
import exit from "process"; import exit from "process";
import updateNotifier from "update-notifier";
import pkg from "./src/package.js";
updateNotifier({ pkg }).notify();
let argv = minimist(process.argv.slice(2), { let argv = minimist(process.argv.slice(2), {
string: "audio-file", string: "audio-file",
}); });
if (argv._.length < 1 || argv.help) { if (argv.version) {
console.log(pkg.version);
} else if (argv._.length < 1 || argv.help) {
console.log(`Usage console.log(`Usage
$ youtube-cue [--audio-file audio.m4a] <youtube_url> [output_file] $ youtube-cue [--audio-file audio.m4a] <youtube_url> [output_file]
@ -32,6 +38,8 @@ if (argv._.length < 1 || argv.help) {
The above 2 are only needed to force behaviour in very specific edge cases, they should The above 2 are only needed to force behaviour in very specific edge cases, they should
not be required for most files. not be required for most files.
--version Print version
Examples Examples
$ youtube-cue --audio-file audio.m4a "https://www.youtube.com/watch?v=THzUassmQwE" $ youtube-cue --audio-file audio.m4a "https://www.youtube.com/watch?v=THzUassmQwE"
"T A Y L O R S W I F T Folklore [Full album].cue" saved "T A Y L O R S W I F T Folklore [Full album].cue" saved

1489
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -18,6 +18,7 @@
"console-log-level": "^1.4.1", "console-log-level": "^1.4.1",
"get-artist-title": "^1.3.1", "get-artist-title": "^1.3.1",
"minimist": "^1.2.5", "minimist": "^1.2.5",
"update-notifier": "^5.1.0",
"ytdl-core": "^4.8.2" "ytdl-core": "^4.8.2"
}, },
"repository": { "repository": {

5
src/package.js Normal file
View File

@ -0,0 +1,5 @@
import { createRequire } from "module";
const require = createRequire(import.meta.url);
const data = require("../package.json");
export default data;