@kokiito0926/pseudoalias 0.0.6 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -6
- package/index.js +12 -9
- package/package.json +1 -1
package/README.md
CHANGED
package/index.js
CHANGED
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
// >> $ ./index.js addition 1 2
|
|
32
32
|
// >> $ ./index.js --unregister
|
|
33
33
|
|
|
34
|
-
import { os,
|
|
34
|
+
import { os, fs, path, argv } from "zx";
|
|
35
35
|
import { pathToFileURL } from "node:url";
|
|
36
36
|
|
|
37
37
|
const CONFIG_DIR = path.join(os.homedir(), ".pseudoalias");
|
|
@@ -40,16 +40,17 @@ const CONFIG_FILE = path.join(CONFIG_DIR, "config.js");
|
|
|
40
40
|
const commands = argv._;
|
|
41
41
|
// console.log(commands);
|
|
42
42
|
|
|
43
|
-
const
|
|
44
|
-
const config = args.config;
|
|
45
|
-
const completion = args.completion;
|
|
43
|
+
const config = argv.config;
|
|
46
44
|
// console.log(argv);
|
|
47
|
-
// console.log(args);
|
|
48
45
|
// process.exit(0);
|
|
49
46
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
47
|
+
/*
|
|
48
|
+
const completion = argv.completion;
|
|
49
|
+
*/
|
|
50
|
+
|
|
51
|
+
if (argv.register) {
|
|
52
|
+
if (argv.config) {
|
|
53
|
+
const absConfigPath = path.resolve(argv.config);
|
|
53
54
|
const configData = fs.readFileSync(absConfigPath, "utf-8");
|
|
54
55
|
|
|
55
56
|
await fs.ensureDir(CONFIG_DIR);
|
|
@@ -64,7 +65,7 @@ if (args.register) {
|
|
|
64
65
|
process.exit(0);
|
|
65
66
|
}
|
|
66
67
|
|
|
67
|
-
if (
|
|
68
|
+
if (argv.unregister) {
|
|
68
69
|
if (await fs.exists(CONFIG_DIR)) {
|
|
69
70
|
await fs.remove(CONFIG_DIR);
|
|
70
71
|
console.log("Success: Unregistered and removed configuration.");
|
|
@@ -100,6 +101,7 @@ try {
|
|
|
100
101
|
// console.log(restArgs);
|
|
101
102
|
// process.exit(0);
|
|
102
103
|
|
|
104
|
+
/*
|
|
103
105
|
if (completion) {
|
|
104
106
|
const args2 = process.argv;
|
|
105
107
|
const prevWord = args2[args2.length - 1];
|
|
@@ -115,6 +117,7 @@ try {
|
|
|
115
117
|
}
|
|
116
118
|
process.exit(0);
|
|
117
119
|
}
|
|
120
|
+
*/
|
|
118
121
|
|
|
119
122
|
if (!subCommand) {
|
|
120
123
|
const availableFunctions = Object.keys(aliasModule).filter((k) => k !== "default");
|