Skip to content

Commit

Permalink
refactor: clean up and improve comments a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
norskeld committed Mar 5, 2024
1 parent b4cebd0 commit 3ac828e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ impl App {
unpacker.unpack_to(&destination)?;

// Now we need to read the manifest (if it is present).
let mut manifest = Manifest::with_options(&destination);
let mut manifest = Manifest::new(&destination);
manifest.load()?;

Ok(manifest)
Expand Down Expand Up @@ -139,7 +139,7 @@ impl App {
}

// Now we need to read the manifest (if it is present).
let mut manifest = Manifest::with_options(&destination);
let mut manifest = Manifest::new(&destination);
manifest.load()?;

Ok(manifest)
Expand Down
10 changes: 5 additions & 5 deletions src/manifest/actions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pub struct Copy {
pub from: String,
/// Where to copy to.
pub to: String,
/// Whether to overwrite or not.
/// Whether to overwrite or not. Defaults to `true`.
pub overwrite: bool,
}

Expand All @@ -20,7 +20,7 @@ pub struct Move {
pub from: String,
/// Where to move to.
pub to: String,
/// Whether to overwrite or not.
/// Whether to overwrite or not. Defaults to `true`.
pub overwrite: bool,
}

Expand All @@ -46,7 +46,7 @@ pub struct Echo {
///
/// All placeholders are processed _before_ running a command.
pub injects: Option<HashSet<String>>,
/// Whether to trim multiline message or not.
/// Whether to trim multiline message or not. Defaults to `true`.
pub trim: bool,
}

Expand All @@ -56,12 +56,12 @@ pub struct Run {
/// Command name. Optional, defaults either to the command itself or to the first line of
/// the multiline command.
pub name: Option<String>,
/// Comannd to run in the shell.
/// Command to run in the shell.
pub command: String,
/// An optional list of placeholders to be injected into the command. Consider the following
/// example:
///
/// We use inject to disambiguate whether `{R_PM}` is part of a command or is a placeholder
/// We use `inject` to disambiguate whether `{R_PM}` is part of a command or is a placeholder
/// that should be replaced with something.
///
/// ```kdl
Expand Down
5 changes: 2 additions & 3 deletions src/manifest/manifest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,9 @@ pub struct Manifest {

impl Manifest {
/// Creates a new manifest from the given path and options.
pub fn with_options(path: &Path) -> Self {
pub fn new(root: &Path) -> Self {
Self {
root: path.to_path_buf(),
root: root.to_path_buf(),
options: ManifestOptions::default(),
actions: Actions::Empty,
}
Expand All @@ -145,7 +145,6 @@ impl Manifest {

/// Checks if the manifest exists under `self.root`.
fn exists(&self) -> bool {
// TODO: Allow to override the config name.
let file = self.root.join(MANIFEST_NAME);
let file_exists = file.try_exists();

Expand Down

0 comments on commit 3ac828e

Please sign in to comment.