-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcmds.rs
106 lines (95 loc) · 3.24 KB
/
cmds.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
use std::collections::HashMap;
pub fn equivalents() -> HashMap<&'static str, HashMap<&'static str, Vec<&'static str>>> {
let npm: HashMap<&str, Vec<&str>> = HashMap::from([
("i", vec!["install"]),
("add", vec!["install"]),
("rm", vec!["uninstall"]),
("up", vec!["update"]),
("run", vec!["run", "{-}", "--"]),
("fz", vec!["ci"]),
("init", vec!["init"]),
]);
let yarn: HashMap<&str, Vec<&str>> = HashMap::from([
("i", vec!["install"]),
("add", vec!["install"]),
("rm", vec!["remove"]),
("up", vec!["upgrade-interactive"]),
("run", vec!["run"]),
("fz", vec!["install", "--frozen-lockfile"]),
]);
let berry: HashMap<&str, Vec<&str>> = HashMap::from([
("i", vec!["install"]),
("add", vec!["install"]),
("rm", vec!["remove"]),
("up", vec!["up", "-i"]),
("run", vec!["run", "--"]),
("fz", vec!["install", "--immutable"]),
]);
let pnpm: HashMap<&str, Vec<&str>> = HashMap::from([
("i", vec!["install"]),
("add", vec!["install"]),
("rm", vec!["remove"]),
("up", vec!["update"]),
("run", vec!["run", "--"]),
("fz", vec!["install", "--frozen-lockfile"]),
]);
let bun: HashMap<&str, Vec<&str>> = HashMap::from([
("i", vec!["install"]),
("add", vec!["install"]),
("rm", vec!["remove"]),
("up", vec!["update", "-i"]),
("run", vec!["run", "--"]),
("fz", vec!["install", "--no-save"]),
]);
let poetry: HashMap<&str, Vec<&str>> = HashMap::from([
("i", vec!["install"]),
("add", vec!["add"]),
("rm", vec!["remove"]),
("up", vec!["update"]),
("run", vec!["run"]),
("fz", vec!["install", "--sync"]),
]);
let cargo: HashMap<&str, Vec<&str>> = HashMap::from([
("i", vec!["install"]),
("add", vec!["add"]),
("rm", vec!["remove"]),
("up", vec!["update"]),
("run", vec!["run"]),
("fz", vec!["install", "--frozen"]),
]);
HashMap::from([
("npm", npm),
("yarn", yarn),
("berry", berry),
("pnpm", pnpm),
("bun", bun),
("poetry", poetry),
("cargo", cargo),
])
}
pub fn alias() -> HashMap<&'static str, Vec<&'static str>> {
HashMap::from([
("i", vec!["install", "i"]),
("add", vec!["install", "add", "i"]),
("rm", vec!["uninstall", "remove", "rm"]),
("up", vec!["update", "upgrade", "up"]),
("run", vec!["run", "r"]),
("fz", vec!["frozen", "fz", "ci"]),
])
}
pub const SUPPORTED_PACKAGE_MANAGERS: [&str; 7] =
["npm", "yarn", "berry", "pnpm", "bun", "poetry", "cargo"];
pub fn install_links() -> HashMap<&'static str, &'static str> {
HashMap::from([
("npm", "https://nodejs.org/en/"),
("yarn", "https://classic.yarnpkg.com/en/docs/install"),
("berry", "https://yarnpkg.com/getting-started/install"),
("pnpm", "https://pnpm.io/installation"),
("bun", "https://bun.sh"),
("poetry", "https://python-poetry.org/docs/#installation"),
(
"cargo",
"https://doc.rust-lang.org/cargo/getting-started/installation.html",
),
])
}