Skip to content

Commit 48dd086

Browse files
committed
Strip em dashes and emojis, trim noisy comments
Make output and source plain ASCII. Replace em dashes with normal punctuation across code, docs, and CLI strings. Drop the hammer from the CLI about text. Switch validate's check/cross markers to OK / WARN / FAIL so the output stays readable in any terminal. Drop comments that just restate the next line of code (e.g. "Load config", "Pre-resolve hooks", "Replace \${VERSION} with package version") and the decorative section banners in main.rs and context.rs. Keep the comments that explain non-obvious decisions (tempdir leak, cache salt, alias resolution, override warning, tilde-at-segment expansion, etc.).
1 parent 3900092 commit 48dd086

11 files changed

Lines changed: 190 additions & 172 deletions

File tree

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ only on the last hyphen when the suffix starts with a digit.
135135
Values resolve in this order: `${PACKAGE_ROOT}`, `${VERSION}`, `${NAME}`,
136136
`${PATHSEP}` (`:` on Unix / `;` on Windows), `${EXE_SUFFIX}` (`""` on Unix /
137137
`".exe"` on Windows), then any `${VAR}` set by previously resolved packages or
138-
the inherited environment, and finally `~/` which expands at every path
138+
the inherited environment, and finally `~/`, which expands at every path
139139
segment, so `~/USD/bin${PATHSEP}~/USD/lib` works as expected. On Windows
140140
PowerShell sessions `~/` falls back to `USERPROFILE` when `HOME` is unset.
141141

@@ -147,7 +147,7 @@ through.
147147

148148
The `commands` map lets `anvil run` pick a program from the package definition.
149149
Values expand the same way as `environment` values, and can include baked in
150-
arguments with whitespace or tilde segments — anvil tokenises the value with
150+
arguments with whitespace or tilde segments. Anvil tokenises the value with
151151
POSIX shell rules, expands `~/` in every token, then runs the first token
152152
with the remaining tokens prepended to whatever the user passes after `--`.
153153

@@ -167,7 +167,7 @@ commands:
167167
```
168168
169169
`anvil run nukex -- --view` therefore exec's
170-
`${NUKE_HOME}/Nuke${VERSION} --nukex --view` — packages can ship sane defaults
170+
`${NUKE_HOME}/Nuke${VERSION} --nukex --view`. Packages can ship sane defaults
171171
for every tool they expose without forcing users to memorise flag soup. Quoted
172172
substrings are preserved as a single argv element, so paths with spaces work
173173
without escaping the whole value.

docs/walkthrough.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,13 @@ anvil info houdini-20.5
6262

6363
```bash
6464
anvil validate
65-
# blender
66-
# houdini
67-
# nuke
68-
# python
69-
# studio-blender-tools
70-
# studio-python
71-
# usd
65+
# OK blender
66+
# OK houdini
67+
# OK nuke
68+
# OK python
69+
# OK studio-blender-tools
70+
# OK studio-python
71+
# OK usd
7272
# All packages valid!
7373
```
7474

@@ -94,7 +94,7 @@ anvil env python-3.11 --json | python3 -c "import sys,json; print(json.load(sys.
9494

9595
### Dependency resolution
9696

97-
Houdini depends on python-3.11 both are resolved automatically:
97+
Houdini depends on python-3.11, and both are resolved automatically:
9898

9999
```bash
100100
anvil env houdini-20.5 | grep -E "PYTHON_VERSION|HOUDINI_VERSION"
@@ -171,7 +171,7 @@ anvil run python-3.11 -e MY_VAR=hello -- env | grep MY_VAR
171171

172172
```bash
173173
# Start a shell with packages loaded
174-
# (will replace the current process type 'exit' to return)
174+
# (will replace the current process; type 'exit' to return)
175175
anvil shell python-3.11
176176

177177
# Specify a different shell

src/cache.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,12 @@ pub fn compute_fingerprint(package_paths: &[PathBuf], config_salt: &str) -> u64
4141
base.hash(&mut hasher);
4242
hash_dir_entries(base, &mut hasher);
4343

44-
// One level deeper for nested packages
4544
if let Ok(entries) = std::fs::read_dir(base) {
4645
for entry in entries.flatten() {
4746
let path = entry.path();
4847
if path.is_dir() {
4948
hash_dir_entries(&path, &mut hasher);
5049

51-
// Check package.yaml files inside version dirs
5250
if let Ok(sub_entries) = std::fs::read_dir(&path) {
5351
for sub in sub_entries.flatten() {
5452
if sub.path().is_dir() {
@@ -116,7 +114,10 @@ fn hash_file_mtime(path: &Path, hasher: &mut impl Hasher) {
116114

117115
/// Try to load cached packages. Returns `Some(packages)` if the cache
118116
/// is valid (fingerprint matches), `None` otherwise.
119-
pub fn load(package_paths: &[PathBuf], config_salt: &str) -> Option<HashMap<String, HashMap<String, Package>>> {
117+
pub fn load(
118+
package_paths: &[PathBuf],
119+
config_salt: &str,
120+
) -> Option<HashMap<String, HashMap<String, Package>>> {
120121
let path = cache_path()?;
121122
if !path.exists() {
122123
return None;

src/cli.rs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use clap::{CommandFactory, Parser, Subcommand};
66
#[command(name = "anvil")]
77
#[command(author = "Alejandro Cabrera <voidreamer@gmail.com>")]
88
#[command(version)]
9-
#[command(about = "Forge your environment 🔨 — Fast package resolution for VFX pipelines", long_about = None)]
9+
#[command(about = "Forge your environment. Fast package resolution for VFX pipelines", long_about = None)]
1010
pub struct Cli {
1111
/// Ignore any cached package scan and re-read all package files.
1212
#[arg(long, global = true)]
@@ -63,7 +63,7 @@ pub enum Commands {
6363
#[arg(short, long)]
6464
shell: Option<String>,
6565

66-
/// Don't materialise `commands:` as PATH shims compose the env only.
66+
/// Don't materialise `commands:` as PATH shims; compose the env only.
6767
#[arg(long)]
6868
env_only: bool,
6969

@@ -170,12 +170,7 @@ pub enum Commands {
170170
impl Cli {
171171
/// Generate shell completions and write to stdout.
172172
pub fn print_completions(shell: clap_complete::Shell) {
173-
clap_complete::generate(
174-
shell,
175-
&mut Self::command(),
176-
"anvil",
177-
&mut std::io::stdout(),
178-
);
173+
clap_complete::generate(shell, &mut Self::command(), "anvil", &mut std::io::stdout());
179174
}
180175
}
181176

src/config.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,6 @@ impl Config {
182182
config.merge(project);
183183
}
184184

185-
// Apply platform overrides and expand paths after merging
186185
config.apply_platform_overrides();
187186
config.expand_paths();
188187

@@ -420,7 +419,10 @@ impl Config {
420419
}
421420

422421
/// Run a list of hook commands. Returns Err if any hook exits non-zero.
423-
pub fn run_hooks(hooks: &[String], env: &std::collections::HashMap<String, String>) -> Result<()> {
422+
pub fn run_hooks(
423+
hooks: &[String],
424+
env: &std::collections::HashMap<String, String>,
425+
) -> Result<()> {
424426
for cmd in hooks {
425427
let shell = if cfg!(target_os = "windows") {
426428
"cmd"
@@ -441,7 +443,11 @@ impl Config {
441443
.with_context(|| format!("Failed to run hook: {}", cmd))?;
442444

443445
if !status.success() {
444-
anyhow::bail!("Hook failed (exit {}): {}", status.code().unwrap_or(-1), cmd);
446+
anyhow::bail!(
447+
"Hook failed (exit {}): {}",
448+
status.code().unwrap_or(-1),
449+
cmd
450+
);
445451
}
446452
}
447453
Ok(())

src/context.rs

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@ use std::path::{Path, PathBuf};
66
use anyhow::{Context as _, Result};
77
use serde::{Deserialize, Serialize};
88

9-
// ---------------------------------------------------------------------------
10-
// Lockfile
11-
// ---------------------------------------------------------------------------
12-
139
/// Pins package versions for reproducible resolution.
1410
///
1511
/// Stored as `anvil.lock` in the project directory. When present, the
@@ -35,7 +31,10 @@ impl Lockfile {
3531
/// Write the lockfile to a YAML file.
3632
pub fn save(&self, path: &Path) -> Result<()> {
3733
let content = serde_yaml::to_string(self)?;
38-
let output = format!("# anvil.lock — generated by `anvil lock`, do not edit\n{}", content);
34+
let output = format!(
35+
"# anvil.lock: generated by `anvil lock`, do not edit\n{}",
36+
content
37+
);
3938
std::fs::write(path, output)
4039
.with_context(|| format!("Failed to write lockfile: {:?}", path))
4140
}
@@ -55,10 +54,6 @@ impl Lockfile {
5554
}
5655
}
5756

58-
// ---------------------------------------------------------------------------
59-
// Saved context
60-
// ---------------------------------------------------------------------------
61-
6257
/// A fully resolved environment that can be saved, shared, and re-loaded
6358
/// without re-running resolution. Useful for render farms, CI, and
6459
/// sharing reproducible environments across machines.

0 commit comments

Comments
 (0)