Skip to content

Commit

Permalink
doc: document workspace
Browse files Browse the repository at this point in the history
  • Loading branch information
Its-Just-Nans committed Feb 17, 2025
1 parent f1a4c86 commit 4efefd0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
4 changes: 3 additions & 1 deletion site/content/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ Trunk supports a layered config system. At the base, a config file can encapsula

# Trunk.toml

Trunk supports an optional `Trunk.toml` config file. An example config file is included [in the Trunk repo](https://github.com/trunk-rs/trunk/blob/main/Trunk.toml), and shows all available config options along with their default values. By default, Trunk will look for a `Trunk.toml` config file in the current working directory. Trunk supports the global `--config` option to specify an alternative location for the file.
Trunk supports an optional `Trunk.toml` config file. An example config file is included [in the Trunk repo](https://github.com/trunk-rs/trunk/blob/main/Trunk.toml), and shows all available config options along with their default values. By default, Trunk will look for a `Trunk.toml` config file in the current working directory.

Trunk supports the global `--config` option to specify an alternative location for the file. But also detects the configuration file in a workspace. If the current directory is a workspace, Trunk will look for a `Trunk.toml` file in the [workspace default-members](https://doc.rust-lang.org/cargo/reference/workspaces.html#the-default-members-field). Or you can specify the workspace member with the `--workspace <name>` option.

Note that any relative paths declared in a `Trunk.toml` file will be treated as being relative to the `Trunk.toml` file itself.

Expand Down
1 change: 1 addition & 0 deletions src/config/models/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ impl ConfigModel for Configuration {
}
}

/// Return the configuration path from the workspace, if available.
pub async fn load_workspace_config(
current_path: &Path,
workspace_name: Option<String>,
Expand Down
2 changes: 2 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ struct Trunk {
#[arg(long, env = "NO_COLOR", global(true))]
pub no_color: bool,

/// Name of the workspace to use
#[arg(long = "workspace", env = "TRUNK_CRATE_WORKSPACE")]
pub crate_workspace: Option<String>,
}
Expand Down Expand Up @@ -178,6 +179,7 @@ impl Trunk {
pub async fn run(self) -> Result<()> {
version::update_check(self.skip_version_check | self.offline.unwrap_or_default());

// if a config path is provided, use it, otherwise try to load from the workspace
let config_path = match self.config {
Some(path) => Some(path),
None => {
Expand Down

0 comments on commit 4efefd0

Please sign in to comment.