Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
127 changes: 122 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ derive_more = {version = "2.0", features = ["add", "display"]}
petgraph = "0.8.2"
strum = {version = "0.27.2", features = ["derive"]}
documented = "0.9.2"
dirs = "6.0.0"
edit = "0.1.5"

[dev-dependencies]
current_dir = "0.1.2"
Expand Down
18 changes: 15 additions & 3 deletions docs/user_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,22 @@
Once you have installed MUSE 2.0, you should be able to run it via the `muse2` command-line program.
For details of the command-line interface, [see here](./command_line_help.md).

You can also configure the behaviour of MUSE 2.0 by creating a `settings.toml` file. For more
information, see [the documentation for this file][settings.toml-docs].
## Modifying the program settings

[settings.toml-docs]: https://energysystemsmodellinglab.github.io/MUSE_2.0/file_formats/program_settings.html
You can configure the behaviour of MUSE 2.0 with a `settings.toml` file. To edit this file, run:

```sh
muse2 settings edit
```

There are also some more commands for working with the settings file; for details, run: `muse2
settings help`.

For information about the available settings, see [the documentation for the `settings.toml`
file][settings.toml-docs].

[settings.toml-docs]:
https://energysystemsmodellinglab.github.io/MUSE_2.0/file_formats/program_settings.html

## Setting the log level

Expand Down
26 changes: 13 additions & 13 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ use std::path::{Path, PathBuf};
pub mod example;
use example::ExampleSubcommands;

pub mod settings;
use settings::SettingsSubcommands;

/// The command line interface for the simulation.
#[derive(Parser)]
#[command(version, about)]
Expand Down Expand Up @@ -59,21 +62,23 @@ enum Commands {
/// The path to the model directory.
model_dir: PathBuf,
},
/// Print default settings file.
DumpDefaultSettings,
/// Manage settings file.
Settings {
/// The subcommands for managing the settings file.
#[command(subcommand)]
subcommand: SettingsSubcommands,
},
}

impl Commands {
/// Execute the supplied CLI command
fn execute(self) -> Result<()> {
match self {
Self::Run { model_dir, opts } => handle_run_command(&model_dir, &opts, None)?,
Self::Example { subcommand } => subcommand.execute()?,
Self::Validate { model_dir } => handle_validate_command(&model_dir, None)?,
Self::DumpDefaultSettings => handle_dump_default_settings(),
Self::Run { model_dir, opts } => handle_run_command(&model_dir, &opts, None),
Self::Example { subcommand } => subcommand.execute(),
Self::Validate { model_dir } => handle_validate_command(&model_dir, None),
Self::Settings { subcommand } => subcommand.execute(),
}

Ok(())
}
}

Expand Down Expand Up @@ -173,8 +178,3 @@ pub fn handle_validate_command(model_path: &Path, settings: Option<Settings>) ->

Ok(())
}

/// Handle the `dump-default-settings` command
fn handle_dump_default_settings() {
print!("{}", Settings::default_file_contents());
}
Loading