Document main and app_state

This commit is contained in:
mo8it
2024-04-29 17:01:47 +02:00
parent 7f73219041
commit b6f40f2ec8
3 changed files with 91 additions and 74 deletions
+7 -5
View File
@@ -40,6 +40,11 @@ const DEBUG_PROFILE: bool = {
debug_profile
};
// The current directory is the official Rustligns repository.
fn in_official_repo() -> bool {
Path::new("dev/rustlings-repo.txt").exists()
}
/// Rustlings is a collection of small exercises to get you used to writing and reading Rust code
#[derive(Parser)]
#[command(version)]
@@ -54,7 +59,7 @@ struct Args {
#[derive(Subcommand)]
enum Subcommands {
/// Initialize Rustlings
/// Initialize the official Rustlings exercises
Init,
/// Run a single exercise. Runs the next pending exercise if the exercise name is not specified
Run {
@@ -76,10 +81,6 @@ enum Subcommands {
Dev(DevCommands),
}
fn in_official_repo() -> bool {
Path::new("dev/rustlings-repo.txt").exists()
}
fn main() -> Result<()> {
let args = Args::parse();
@@ -123,6 +124,7 @@ fn main() -> Result<()> {
info_file.final_message.unwrap_or_default(),
)?;
// Show the welcome message if the state file doesn't exist yet.
if let Some(welcome_message) = info_file.welcome_message {
match state_file_status {
StateFileStatus::NotRead => {