Skip to content

Commit 59272d9

Browse files
committed
refactor: better help menus
1 parent a58dc04 commit 59272d9

File tree

1 file changed

+78
-73
lines changed

1 file changed

+78
-73
lines changed

src/bin/jlpkg.rs

Lines changed: 78 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,23 @@
11
use anyhow::Result;
22
use clap::{Parser, Subcommand, ValueEnum};
33

4+
// IMPORTANT: This CLI wrapper for Julia's Pkg does NOT include the following REPL-only commands:
5+
//
6+
// 1. `activate` - This command changes the active environment within a REPL session.
7+
// In a CLI context, each invocation is stateless. Users should use Julia's --project
8+
// flag or JULIA_PROJECT environment variable to specify the project instead.
9+
//
10+
// 2. `undo` - This command undoes the last change within a REPL session.
11+
// In a CLI context, there is no session state to undo. Each command invocation
12+
// is independent and stateless.
13+
//
14+
// 3. `redo` - This command redoes an undone change within a REPL session.
15+
// In a CLI context, there is no session state to redo. Each command invocation
16+
// is independent and stateless.
17+
//
18+
// These commands are fundamentally REPL-specific as they rely on persistent session state
19+
// that doesn't exist in one-time CLI invocations. DO NOT add these commands to this CLI.
20+
421
#[derive(Parser)]
522
#[command(name = "jlpkg")]
623
#[command(about = "Julia package manager", long_about = None)]
@@ -28,6 +45,13 @@ enum PreserveLevel {
2845
Tiered,
2946
}
3047

48+
#[derive(Clone, ValueEnum)]
49+
enum UpdatePreserveLevel {
50+
All,
51+
Direct,
52+
None,
53+
}
54+
3155
#[derive(Subcommand)]
3256
enum PkgCommand {
3357
/// Add packages to project
@@ -73,12 +97,12 @@ enum PkgCommand {
7397
/// Package specifications or paths to develop
7498
packages: Vec<String>,
7599

76-
/// Only download the package
100+
/// Clone package to local project dev folder
77101
#[arg(short = 'l', long)]
78102
local: bool,
79103

80-
/// Install the dependencies of the package
81-
#[arg(short = 'd', long)]
104+
/// Clone package to shared dev folder (default)
105+
#[arg(long)]
82106
shared: bool,
83107

84108
/// Preserve level for existing dependencies
@@ -90,27 +114,27 @@ enum PkgCommand {
90114
Free {
91115
/// Packages to free (all if empty)
92116
packages: Vec<String>,
117+
118+
/// Free all packages
119+
#[arg(long)]
120+
all: bool,
93121
},
94122

95123
/// Generate files for packages
96124
Generate {
97125
/// Package name
98126
package: String,
99-
100-
/// Generate package in its own directory
101-
#[arg(short = 't', long)]
102-
template: bool,
103127
},
104128

105129
/// Garbage collect packages not used for a significant time
106130
Gc {
131+
/// Show verbose output
132+
#[arg(short = 'v', long)]
133+
verbose: bool,
134+
107135
/// Delete all packages that cannot be reached from any existing environment
108136
#[arg(long)]
109137
all: bool,
110-
111-
/// Only log packages that would be garbage collected
112-
#[arg(long)]
113-
dry_run: bool,
114138
},
115139

116140
/// Download and install all artifacts in the manifest
@@ -119,13 +143,13 @@ enum PkgCommand {
119143
#[arg(short = 'v', long)]
120144
verbose: bool,
121145

122-
/// Manifest file to instantiate
123-
#[arg(short = 'm', long, value_name = "PATH")]
124-
manifest: Option<String>,
146+
/// Use manifest mode
147+
#[arg(short = 'm', long)]
148+
manifest: bool,
125149

126-
/// Project directory
127-
#[arg(short = 'p', long, value_name = "PATH", id = "proj")]
128-
project: Option<String>,
150+
/// Use project mode
151+
#[arg(short = 'p', long)]
152+
project: bool,
129153
},
130154

131155
/// Pin packages
@@ -142,38 +166,6 @@ enum PkgCommand {
142166
Precompile {
143167
/// Packages to precompile (all if empty)
144168
packages: Vec<String>,
145-
146-
/// Force recompilation
147-
#[arg(long)]
148-
force: bool,
149-
150-
/// Precompile for different configuration
151-
#[arg(long)]
152-
check_bounds: Option<String>,
153-
154-
/// Precompile for inlining or not
155-
#[arg(long)]
156-
inline: Option<bool>,
157-
158-
/// Precompile package dependencies in parallel
159-
#[arg(short = 'j', long)]
160-
jobs: Option<usize>,
161-
162-
/// Precompile all configurations
163-
#[arg(long)]
164-
all: bool,
165-
166-
/// Precompile in strict mode
167-
#[arg(long)]
168-
strict: bool,
169-
170-
/// Warn when precompiling
171-
#[arg(long)]
172-
warn_loaded: bool,
173-
174-
/// Only check if packages need precompilation
175-
#[arg(long)]
176-
already_instantiated: bool,
177169
},
178170

179171
/// Remove packages from project
@@ -182,16 +174,16 @@ enum PkgCommand {
182174
/// Packages to remove
183175
packages: Vec<String>,
184176

185-
/// Update manifest
186-
#[arg(short = 'u', long)]
187-
update: bool,
177+
/// Use project mode
178+
#[arg(short = 'p', long)]
179+
project: bool,
188180

189-
/// Remove mode
190-
#[arg(short = 'm', long, value_name = "manifest|project|deps|all")]
191-
mode: Option<String>,
181+
/// Use manifest mode
182+
#[arg(short = 'm', long)]
183+
manifest: bool,
192184

193185
/// Remove all packages
194-
#[arg(short = 'a', long)]
186+
#[arg(long)]
195187
all: bool,
196188
},
197189

@@ -202,10 +194,7 @@ enum PkgCommand {
202194
},
203195

204196
/// Resolve versions in the manifest
205-
Resolve {
206-
/// Packages to resolve
207-
packages: Vec<String>,
208-
},
197+
Resolve,
209198

210199
/// Show project status
211200
#[command(visible_alias = "st")]
@@ -217,8 +206,8 @@ enum PkgCommand {
217206
#[arg(short = 'c', long)]
218207
compat: bool,
219208

220-
/// Show test dependency compatibility status
221-
#[arg(short = 't', long)]
209+
/// Show extension dependencies
210+
#[arg(short = 'e', long)]
222211
extensions: bool,
223212

224213
/// Show manifest status instead of project status
@@ -232,20 +221,16 @@ enum PkgCommand {
232221
/// Show status of outdated packages
233222
#[arg(short = 'o', long)]
234223
outdated: bool,
235-
236-
/// Show status as a table
237-
#[arg(long)]
238-
as_table: bool,
239224
},
240225

241226
/// Run tests for packages
242227
Test {
243228
/// Packages to test (all if empty)
244229
packages: Vec<String>,
245230

246-
/// Set code coverage to track
247-
#[arg(long, value_name = "none|user|all")]
248-
coverage: Option<String>,
231+
/// Run tests with coverage enabled
232+
#[arg(long)]
233+
coverage: bool,
249234
},
250235

251236
/// Update packages in manifest
@@ -254,13 +239,33 @@ enum PkgCommand {
254239
/// Packages to update (all if empty)
255240
packages: Vec<String>,
256241

257-
/// Preserve level for existing dependencies
258-
#[arg(long, value_enum)]
259-
preserve: Option<PreserveLevel>,
242+
/// Use project mode
243+
#[arg(short = 'p', long)]
244+
project: bool,
260245

261-
/// Update manifest
246+
/// Use manifest mode
262247
#[arg(short = 'm', long)]
263248
manifest: bool,
249+
250+
/// Only update within major version
251+
#[arg(long)]
252+
major: bool,
253+
254+
/// Only update within minor version
255+
#[arg(long)]
256+
minor: bool,
257+
258+
/// Only update within patch version
259+
#[arg(long)]
260+
patch: bool,
261+
262+
/// Do not update
263+
#[arg(long)]
264+
fixed: bool,
265+
266+
/// Preserve level for existing dependencies
267+
#[arg(long, value_enum)]
268+
preserve: Option<UpdatePreserveLevel>,
264269
},
265270

266271
/// Explains why a package is in the dependency graph

0 commit comments

Comments
 (0)