Skip to content

Commit c369789

Browse files
authored
fix(config): --spa implies --index option (#422)
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
1 parent cf47906 commit c369789

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/config/mod.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,8 @@ impl TryFrom<Cli> for Config {
188188
None
189189
};
190190

191-
let index = cli_arguments.index;
192191
let spa = cli_arguments.spa;
192+
let index = spa || cli_arguments.index;
193193

194194
Ok(Config {
195195
host: cli_arguments.host,
@@ -225,8 +225,9 @@ impl TryFrom<ConfigFile> for Config {
225225
} else {
226226
None
227227
};
228-
let index = file.index.unwrap_or(false);
228+
229229
let spa = file.spa.unwrap_or(false);
230+
let index = spa || file.index.unwrap_or(false);
230231

231232
Ok(Config {
232233
host: file.host,

0 commit comments

Comments
 (0)