Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ clap = { version = "4.5.38", features = ["derive"] }
clap-markdown = "0.1.5"
ctrlc = "3.4.7"
inquire = "0.7.5"
open = "5.3.3"
reqwest = { version = "0.12.20", features = ["blocking"] }
serde = { version = "1.0.219", features = ["derive"] }
serde_json = "1.0.140"
Expand Down
23 changes: 11 additions & 12 deletions src/bin/oseda.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ use std::{error::Error, process};

use clap::Parser;
use oseda_cli::{Cli, Commands, cmd::{
check,
deploy::{self},
init, run,
check, deploy::{self}, fork::{self}, init, run
}};

/// CLI entry point
Expand All @@ -14,18 +12,19 @@ fn main() {
// match on every subcommand result
let result: Result<(), Box<dyn Error>> = match cli.command {
Commands::Init(options) => {
init::init(options).map(|_| println!("Successfully initialized oseda project"))
}
init::init(options).map(|_| println!("Successfully initialized oseda project"))
}
Commands::Run => run::run()
.map(|_| println!("Successfully ran oseda project"))
.map_err(|e| e.into()),
.map(|_| println!("Successfully ran oseda project"))
.map_err(|e| e.into()),
Commands::Check(options) => check::check(options)
.map(|_| println!("Successfully checked oseda project"))
.map_err(|e| e.into()),
.map(|_| println!("Successfully checked oseda project"))
.map_err(|e| e.into()),
Commands::Deploy(options) => deploy::deploy(options).map(|_| {
println!("Successfully deployed oseda project");
println!("See deployment instructions...");
}),
println!("Successfully deployed oseda project");
println!("See deployment instructions...");
}),
Commands::Fork => fork::fork(),
};

// little annoying, but makes the exit code match what users would expect
Expand Down
13 changes: 13 additions & 0 deletions src/cmd/fork.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
use std::error::Error;


pub fn fork() -> Result<(), Box<dyn Error>> {

let fork_url = "https://github.com/oseda-dev/oseda-lib/fork".to_owned();

open::that(fork_url.clone()).map_err(|_|{
format!("Please visit {fork_url} in a browser and fork the oseda-lib repository")
})?;

Ok(())
}
1 change: 1 addition & 0 deletions src/cmd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ pub mod check;
pub mod deploy;
pub mod init;
pub mod run;
pub mod fork;
2 changes: 2 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,6 @@ pub enum Commands {
Check(cmd::check::CheckOptions),
/// Deploy your Oseda project to github to add to oseda.net
Deploy(cmd::deploy::DeployOptions),
/// Fork the library repository to submit your course
Fork,
}
Loading