Skip to content

Commit

Permalink
fix(config): --spa implies --index option (#422)
Browse files Browse the repository at this point in the history
If #420 there was still an issue that `--spa would work very weirdly
without `--index`; single page applications are never implemented
without also using `index.html` files. This PR fixes this by
automatically setting `cli.index` to `true` if `cli.spa` is set to true.

I could throw an error if the `--index` flag is not passed in with
`--spa`, but I think those are way too many keystrokes for a feature
someone would already expect

I manually tested this and it works great for every case
  • Loading branch information
Antosser committed Feb 27, 2024
1 parent cf47906 commit c369789
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,8 @@ impl TryFrom<Cli> for Config {
None
};

let index = cli_arguments.index;
let spa = cli_arguments.spa;
let index = spa || cli_arguments.index;

Ok(Config {
host: cli_arguments.host,
Expand Down Expand Up @@ -225,8 +225,9 @@ impl TryFrom<ConfigFile> for Config {
} else {
None
};
let index = file.index.unwrap_or(false);

let spa = file.spa.unwrap_or(false);
let index = spa || file.index.unwrap_or(false);

Ok(Config {
host: file.host,
Expand Down

0 comments on commit c369789

Please sign in to comment.