11use anyhow:: { Context , Result } ;
22use clap:: Parser ;
33use juliaup:: cli:: { ConfigSubCmd , Juliaup , OverrideSubCmd , SelfSubCmd } ;
4- use juliaup:: command_api:: run_command_api;
5- use juliaup:: command_completions:: generate_completion_for_command;
6- use juliaup:: command_config_autoinstall:: run_command_config_autoinstall;
7- #[ cfg( not( windows) ) ]
8- use juliaup:: command_config_symlinks:: run_command_config_symlinks;
9- use juliaup:: command_config_versionsdbupdate:: run_command_config_versionsdbupdate;
10- use juliaup:: command_default:: run_command_default;
11- use juliaup:: command_gc:: run_command_gc;
12- use juliaup:: command_info:: run_command_info;
13- use juliaup:: command_initial_setup_from_launcher:: run_command_initial_setup_from_launcher;
14- use juliaup:: command_link:: run_command_link;
15- use juliaup:: command_list:: run_command_list;
16- use juliaup:: command_override:: { run_command_override_status, run_command_override_unset} ;
17- use juliaup:: command_remove:: run_command_remove;
18- use juliaup:: command_selfupdate:: run_command_selfupdate;
19- use juliaup:: command_status:: run_command_status;
20- use juliaup:: command_update:: run_command_update;
21- use juliaup:: command_update_version_db:: run_command_update_version_db;
4+ use juliaup:: command;
225use juliaup:: global_paths:: get_paths;
23- use juliaup:: { command_add:: run_command_add, command_override:: run_command_override_set} ;
24- #[ cfg( feature = "selfupdate" ) ]
25- use juliaup:: {
26- command_config_backgroundselfupdate:: run_command_config_backgroundselfupdate,
27- command_config_modifypath:: run_command_config_modifypath,
28- command_config_startupselfupdate:: run_command_config_startupselfupdate,
29- command_selfchannel:: run_command_selfchannel,
30- } ;
31-
32- #[ cfg( feature = "selfupdate" ) ]
33- use juliaup:: command_selfuninstall:: run_command_selfuninstall;
34-
35- #[ cfg( not( feature = "selfupdate" ) ) ]
36- use juliaup:: command_selfuninstall:: run_command_selfuninstall_unavailable;
376
387use log:: info;
398
@@ -48,7 +17,7 @@ fn main() -> Result<()> {
4817 . write_style ( "JULIAUP_LOG_STYLE" ) ;
4918 env_logger:: init_from_env ( env) ;
5019
51- #[ cfg( feature = "winpkgidentityext" ) ]
20+ #[ cfg( all ( windows , feature = "winpkgidentityext" ) ) ]
5221 {
5322 use windows:: Management :: Deployment :: { AddPackageOptions , PackageManager } ;
5423
@@ -92,68 +61,68 @@ fn main() -> Result<()> {
9261 let paths = get_paths ( ) . with_context ( || "Trying to load all global paths." ) ?;
9362
9463 match args {
95- Juliaup :: Default { channel } => run_command_default ( & channel, & paths) ,
96- Juliaup :: Add { channel } => run_command_add ( & channel, & paths) ,
97- Juliaup :: Remove { channel } => run_command_remove ( & channel, & paths) ,
98- Juliaup :: Status { } => run_command_status ( & paths) ,
99- Juliaup :: Update { channel } => run_command_update ( & channel, & paths) ,
100- Juliaup :: Gc { prune_linked } => run_command_gc ( prune_linked, & paths) ,
64+ Juliaup :: Default { channel } => command :: default :: run ( & channel, & paths) ,
65+ Juliaup :: Add { channel } => command :: add :: run ( & channel, & paths) ,
66+ Juliaup :: Remove { channel } => command :: remove :: run ( & channel, & paths) ,
67+ Juliaup :: Status { } => command :: status :: run ( & paths) ,
68+ Juliaup :: Update { channel } => command :: update :: run ( & channel, & paths) ,
69+ Juliaup :: Gc { prune_linked } => command :: gc :: run ( prune_linked, & paths) ,
10170 Juliaup :: Link {
10271 channel,
10372 target,
10473 args,
105- } => run_command_link ( & channel, & target, & args, & paths) ,
106- Juliaup :: List { } => run_command_list ( & paths) ,
74+ } => command :: link :: run ( & channel, & target, & args, & paths) ,
75+ Juliaup :: List { } => command :: list :: run ( & paths) ,
10776 Juliaup :: Config ( subcmd) => match subcmd {
10877 #[ cfg( not( windows) ) ]
10978 ConfigSubCmd :: ChannelSymlinks { value } => {
110- run_command_config_symlinks ( value, false , & paths)
79+ command :: config :: symlinks :: run ( value, false , & paths)
11180 }
11281 #[ cfg( feature = "selfupdate" ) ]
11382 ConfigSubCmd :: BackgroundSelfupdateInterval { value } => {
114- run_command_config_backgroundselfupdate ( value, false , & paths)
83+ command :: config :: background_self_update :: run ( value, false , & paths)
11584 }
11685 #[ cfg( feature = "selfupdate" ) ]
11786 ConfigSubCmd :: StartupSelfupdateInterval { value } => {
118- run_command_config_startupselfupdate ( value, false , & paths)
87+ command :: config :: startup_self_update :: run ( value, false , & paths)
11988 }
12089 #[ cfg( feature = "selfupdate" ) ]
12190 ConfigSubCmd :: ModifyPath { value } => {
122- run_command_config_modifypath ( value, false , & paths)
91+ command :: config :: modify_path :: run ( value, false , & paths)
12392 }
12493 ConfigSubCmd :: VersionsDbUpdateInterval { value } => {
125- run_command_config_versionsdbupdate ( value, false , & paths)
94+ command :: config :: versionsdb_update :: run ( value, false , & paths)
12695 }
12796 ConfigSubCmd :: AutoInstallChannels { value } => {
128- run_command_config_autoinstall ( value, false , & paths)
97+ command :: config :: autoinstall :: run ( value, false , & paths)
12998 }
13099 } ,
131- Juliaup :: Api { command } => run_command_api ( & command, & paths) ,
132- Juliaup :: InitialSetupFromLauncher { } => run_command_initial_setup_from_launcher ( & paths) ,
133- Juliaup :: UpdateVersionDb { } => run_command_update_version_db ( & paths) ,
100+ Juliaup :: Api { command } => command :: api :: run ( & command, & paths) ,
101+ Juliaup :: InitialSetupFromLauncher { } => command :: initial_setup_from_launcher :: run ( & paths) ,
102+ Juliaup :: UpdateVersionDb { } => command :: update_versiondb :: run ( & paths) ,
134103 Juliaup :: OverrideSubCmd ( subcmd) => match subcmd {
135- OverrideSubCmd :: Status { } => run_command_override_status ( & paths) ,
104+ OverrideSubCmd :: Status { } => command :: r#override :: status ( & paths) ,
136105 OverrideSubCmd :: Set { channel, path } => {
137- run_command_override_set ( & paths, channel, path)
106+ command :: r#override :: set ( & paths, channel, path)
138107 }
139108 OverrideSubCmd :: Unset { nonexistent, path } => {
140- run_command_override_unset ( & paths, nonexistent, path)
109+ command :: r#override :: unset ( & paths, nonexistent, path)
141110 }
142111 } ,
143- Juliaup :: Info { } => run_command_info ( & paths) ,
112+ Juliaup :: Info { } => command :: info :: run ( & paths) ,
144113 #[ cfg( feature = "selfupdate" ) ]
145- Juliaup :: SecretSelfUpdate { } => run_command_selfupdate ( & paths) ,
114+ Juliaup :: SecretSelfUpdate { } => command :: selfupdate :: run ( & paths) ,
146115 Juliaup :: SelfSubCmd ( subcmd) => match subcmd {
147- SelfSubCmd :: Update { } => run_command_selfupdate ( & paths) ,
116+ SelfSubCmd :: Update { } => command :: selfupdate :: run ( & paths) ,
148117 #[ cfg( feature = "selfupdate" ) ]
149- SelfSubCmd :: Channel { channel } => run_command_selfchannel ( channel, & paths) ,
118+ SelfSubCmd :: Channel { channel } => command :: selfchannel :: run ( channel, & paths) ,
150119 #[ cfg( feature = "selfupdate" ) ]
151- SelfSubCmd :: Uninstall { } => run_command_selfuninstall ( & paths) ,
120+ SelfSubCmd :: Uninstall { } => command :: selfuninstall :: run ( & paths) ,
152121 #[ cfg( not( feature = "selfupdate" ) ) ]
153- SelfSubCmd :: Uninstall { } => run_command_selfuninstall_unavailable ( ) ,
122+ SelfSubCmd :: Uninstall { } => command :: selfuninstall :: unavailable ( ) ,
154123 } ,
155124 Juliaup :: Completions { shell } => {
156- generate_completion_for_command :: < Juliaup > ( shell, "juliaup" )
125+ command :: completions :: generate :: < Juliaup > ( shell, "juliaup" )
157126 }
158127 }
159128}
0 commit comments