-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
basic Twoliter.toml file #23
Conversation
Implement structs for a basic Twoliter.toml project file.
project_path: Option<PathBuf>, | ||
|
||
/// The architecture to build for. | ||
#[clap(long = "arch", default_value = "x86_64")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's possibly worth defaulting to the machine architecture.
/// Recursively search for a file named `Twoliter.toml` starting in `dir`. If it is not found, | ||
/// move up (i.e. `cd ..`) until it is found. Return an error if there is no parent directory. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reading this I found myself wondering if Rust had TCO.
Presumably we would not encounter a directory structure in the wild that could blow the call stack, but I still learned something reading about it.
} | ||
} | ||
|
||
/// We need to constrain the `Project` struct to a valid version. Unfortunately `serde` does not |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is clever (the good kind). Nice.
// Move up a level and recurse. | ||
let parent = dir | ||
.parent() | ||
.context("Unable to find Twoliter.toml file")? | ||
.to_owned(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Potentially we could stop as soon as we reach a directory that has a .git
subdirectory, since beyond that point it's unlikely we're going to find the Twoliter.toml
that the user expects.
#[derive(Default, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)] | ||
pub(crate) struct SchemaVersion<const N: u32>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: this could be in a different module
I captured these ideas as issues for follow up. |
Issue #, if available:
Closes #7
Description of changes:
Implement structs for a basic
Twoliter.toml
project file.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.