Skip to content

Commit 453e3de

Browse files
Actually fix #139
1 parent 30d3818 commit 453e3de

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

src/main.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,18 @@ fn main() -> ExitCode {
5959

6060
#[allow(clippy::future_not_send)] // 3rd party library doesn't implement `Send`
6161
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+
6274
let github = Arc::new(
6375
cli_app
6476
.github_token
@@ -78,26 +90,14 @@ async fn actual_main(cli_app: Ferium) -> Result<()> {
7890
let curseforge = Arc::new(Furse::new(&var("CURSEFORGE_API_KEY").unwrap_or_else(
7991
|_| "$2a$10$QbCxI6f4KxEs50QKwE2piu1t6oOA8ayOw27H9N/eaH3Sdp5NTWwvO".into(),
8092
)));
93+
8194
let mut config_file = config::get_file(
8295
cli_app
8396
.config_file
8497
.or_else(|| var_os("FERIUM_CONFIG_FILE").map(Into::into))
8598
.unwrap_or_else(config::file_path),
8699
)
87100
.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-
101101
let mut config = config::deserialise(&config::read_file(&mut config_file).await?)?;
102102

103103
// Run function(s) based on the sub(sub)command to be executed

0 commit comments

Comments
 (0)