summaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
authormo8it <mo8it@proton.me>2024-04-29 17:01:47 +0200
committermo8it <mo8it@proton.me>2024-04-29 17:01:47 +0200
commitb6f40f2ec86abc70e7b8548996c948f6c5563f46 (patch)
treed23864829f9fc1bd9eb6ecaa55da6933456c8b47 /src/main.rs
parent7f73219041fc6659d2e8e944c4e1d0341e323478 (diff)
Document main and app_state
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/main.rs b/src/main.rs
index bb70a75..c51f63c 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -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 => {