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
2 changes: 1 addition & 1 deletion Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ homepage = "https://oseda.net"
repository = "https://github.com/oseda-dev/oseda-cli"
readme = "README.md"
name = "oseda-cli"
version = "2.6.2"
version = "2.7.0"
edition = "2021"

[[bin]]
Expand Down
10 changes: 10 additions & 0 deletions Usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ This document contains the help content for the `oseda` command-line program.
* [`oseda deploy`↴](#oseda-deploy)
* [`oseda fork`↴](#oseda-fork)
* [`oseda export`↴](#oseda-export)
* [`oseda update`↴](#oseda-update)

## `oseda`

Expand All @@ -26,6 +27,7 @@ oseda project scafolding CLI
* `deploy` — Deploy your Oseda project to github to add to oseda.net
* `fork` — Fork the library repository to submit your course
* `export` — Export the Oseda project to a PDF file This will install the npm package `decktape` This relies on a chromium backend, as a result, it may take a while to run
* `update` — Update the oseda binary from crates.io



Expand Down Expand Up @@ -104,6 +106,14 @@ Export the Oseda project to a PDF file This will install the npm package `deckta



## `oseda update`

Update the oseda binary from crates.io

**Usage:** `oseda update`



<hr/>

<small><i>
Expand Down
6 changes: 5 additions & 1 deletion src/bin/oseda.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use oseda_cli::{
deploy::{self},
export::{self},
fork::{self},
init, run,
init, run, update,
},
Cli, Commands,
};
Expand All @@ -34,6 +34,10 @@ fn main() {
Commands::Fork => fork::fork(),
Commands::Export(options) => export::export(options.clone())
.map(|_| println!("Successfully export project to {0}", options.port)),
Commands::Update => update::update().map(|_| {
println!("Successfully updated oseda");
println!("You may need to restart the shell for updates to take effect")
}),
};

// little annoying, but makes the exit code match what users would expect
Expand Down
1 change: 1 addition & 0 deletions src/cmd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ pub mod export;
pub mod fork;
pub mod init;
pub mod run;
pub mod update;
18 changes: 18 additions & 0 deletions src/cmd/update.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
use std::{
error::Error,
process::{Command, Stdio},
};

pub fn update() -> Result<(), Box<dyn Error>> {
let status = Command::new("cargo")
.args(["install", "oseda-cli"])
.stdout(Stdio::inherit())
.stdin(Stdio::inherit())
.status()?;

if !status.success() {
return Err(format!("Error: exit status {}", status).into());
}

Ok(())
}
2 changes: 2 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,6 @@ pub enum Commands {
/// This will install the npm package `decktape`
/// This relies on a chromium backend, as a result, it may take a while to run
Export(cmd::export::ExportOptions),
/// Update the oseda binary from crates.io
Update,
}
Loading