Skip to content

Commit 8a1d0a7

Browse files
committed
raw -> all
1 parent abae362 commit 8a1d0a7

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

nix-script-directives/src/lib.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ pub struct Directives {
2121
pub runtime_inputs: Vec<Expr>,
2222
pub runtime_files: Vec<PathBuf>,
2323
pub nixpkgs_config: Option<Expr>,
24-
pub raw: HashMap<String, Vec<String>>,
24+
pub all: HashMap<String, Vec<String>>,
2525
}
2626

2727
impl Directives {
@@ -31,7 +31,7 @@ impl Directives {
3131
}
3232

3333
fn parse(indicator: &str, source: &str) -> Result<Self> {
34-
let parser = Parser::new(indicator).context("could not construct a parser")?;
34+
let parser = Parser::new(indicator).context("could not construct parser")?;
3535
let fields = parser.parse(source);
3636

3737
Self::from_directives(fields)
@@ -54,7 +54,7 @@ impl Directives {
5454
runtime_inputs,
5555
runtime_files,
5656
nixpkgs_config,
57-
raw: fields
57+
all: fields
5858
.iter()
5959
.map(|(k, v)| (k.to_string(), v.iter().map(|s| s.to_string()).collect()))
6060
.collect(),
@@ -68,7 +68,7 @@ impl Directives {
6868
match fields.get(field) {
6969
Some(value) => {
7070
if value.len() != 1 {
71-
anyhow::bail!("multiple `{}` directives but need a single one", field);
71+
anyhow::bail!("multiple `{}` directives but need exactly one", field);
7272
}
7373

7474
Ok(Some(value[0]))
@@ -312,7 +312,7 @@ mod tests {
312312

313313
assert_eq!(
314314
Some(&vec!["other".to_string()]),
315-
directives.raw.get("other")
315+
directives.all.get("other")
316316
)
317317
}
318318

nix-script-haskell/src/main.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,18 +64,18 @@ impl Opts {
6464
let build_command = format!(
6565
"mv $SRC $SRC.hs; ghc {} -o $OUT $SRC.hs",
6666
directives
67-
.raw
67+
.all
6868
.get("ghcFlags")
6969
.map(|ps| ps.join(" "))
70-
.unwrap_or_else(|| String::from(" "))
70+
.unwrap_or_default()
7171
);
7272
log::debug!("build command is `{}`", build_command);
7373
nix_script.arg("--build-command").arg(build_command);
7474

7575
let compiler = format!(
7676
"haskellPackages.ghcWithPackages (ps: with ps; [ {} ])",
7777
directives
78-
.raw
78+
.all
7979
.get("haskellPackages")
8080
.map(|ps| ps.join(" "))
8181
.unwrap_or_default()

0 commit comments

Comments
 (0)