@@ -59,6 +59,18 @@ fn main() -> ExitCode {
59
59
60
60
#[ allow( clippy:: future_not_send) ] // 3rd party library doesn't implement `Send`
61
61
async fn actual_main ( cli_app : Ferium ) -> Result < ( ) > {
62
+ // The complete command should not require a config.
63
+ // See [#139](https://github.com/gorilla-devs/ferium/issues/139) for why this might be a problem.
64
+ if let SubCommands :: Complete { shell } = cli_app. subcommand {
65
+ clap_complete:: generate (
66
+ shell,
67
+ & mut Ferium :: command ( ) ,
68
+ "ferium" ,
69
+ & mut std:: io:: stdout ( ) ,
70
+ ) ;
71
+ return Ok ( ( ) ) ;
72
+ }
73
+
62
74
let github = Arc :: new (
63
75
cli_app
64
76
. github_token
@@ -78,26 +90,14 @@ async fn actual_main(cli_app: Ferium) -> Result<()> {
78
90
let curseforge = Arc :: new ( Furse :: new ( & var ( "CURSEFORGE_API_KEY" ) . unwrap_or_else (
79
91
|_| "$2a$10$QbCxI6f4KxEs50QKwE2piu1t6oOA8ayOw27H9N/eaH3Sdp5NTWwvO" . into ( ) ,
80
92
) ) ) ;
93
+
81
94
let mut config_file = config:: get_file (
82
95
cli_app
83
96
. config_file
84
97
. or_else ( || var_os ( "FERIUM_CONFIG_FILE" ) . map ( Into :: into) )
85
98
. unwrap_or_else ( config:: file_path) ,
86
99
)
87
100
. await ?;
88
-
89
- // The complete command should not require a config.
90
- // See [#139](https://github.com/gorilla-devs/ferium/issues/139) for why this might be a problem.
91
- if let SubCommands :: Complete { shell } = cli_app. subcommand {
92
- clap_complete:: generate (
93
- shell,
94
- & mut Ferium :: command ( ) ,
95
- "ferium" ,
96
- & mut std:: io:: stdout ( ) ,
97
- ) ;
98
- return Ok ( ( ) ) ;
99
- }
100
-
101
101
let mut config = config:: deserialise ( & config:: read_file ( & mut config_file) . await ?) ?;
102
102
103
103
// Run function(s) based on the sub(sub)command to be executed
0 commit comments