forked from rojo-rbx/rojo
Add 'rojo doc' command
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
## Unreleased Changes for 0.6.x
|
||||
* Added `--watch` argument to `rojo build`. ([#284](https://github.com/rojo-rbx/rojo/pull/284))
|
||||
* Added dark theme support to plugin. ([#241](https://github.com/rojo-rbx/rojo/issues/241))
|
||||
* Added the `rojo doc` command, which opens Rojo's documentation in your browser.
|
||||
* Simplified filesystem access code dramatically.
|
||||
* Improved error reporting and logging across the board.
|
||||
* Log messages have a less noisy prefix.
|
||||
|
||||
10
Cargo.lock
generated
10
Cargo.lock
generated
@@ -1073,6 +1073,14 @@ name = "opaque-debug"
|
||||
version = "0.2.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "opener"
|
||||
version = "0.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "openssl"
|
||||
version = "0.10.28"
|
||||
@@ -1681,6 +1689,7 @@ dependencies = [
|
||||
"maplit 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"memofs 0.1.0",
|
||||
"notify 4.0.15 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"opener 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"paste 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"pretty_assertions 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rbx_binary 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@@ -2647,6 +2656,7 @@ dependencies = [
|
||||
"checksum num_cpus 1.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "46203554f085ff89c235cd12f7075f3233af9b11ed7c9e16dfe2560d03313ce6"
|
||||
"checksum oorandom 11.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ebcec7c9c2a95cacc7cd0ecb89d8a8454eca13906f6deb55258ffff0adeb9405"
|
||||
"checksum opaque-debug 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c"
|
||||
"checksum opener 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "13117407ca9d0caf3a0e74f97b490a7e64c0ae3aa90a8b7085544d0c37b6f3ae"
|
||||
"checksum openssl 0.10.28 (registry+https://github.com/rust-lang/crates.io-index)" = "973293749822d7dd6370d6da1e523b0d1db19f06c459134c658b2a4261378b52"
|
||||
"checksum openssl-probe 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "77af24da69f9d9341038eba93a073b1fdaaa1b788221b00a69bce9e762cb32de"
|
||||
"checksum openssl-sys 0.9.54 (registry+https://github.com/rust-lang/crates.io-index)" = "1024c0a59774200a555087a6da3f253a9095a5f344e353b212ac4c8b8e450986"
|
||||
|
||||
@@ -62,8 +62,8 @@ harness = false
|
||||
|
||||
[dependencies]
|
||||
memofs = { version = "0.1.0", path = "memofs" }
|
||||
backtrace = "0.3"
|
||||
|
||||
backtrace = "0.3"
|
||||
crossbeam-channel = "0.4.0"
|
||||
csv = "1.1.1"
|
||||
env_logger = "0.7.1"
|
||||
@@ -76,6 +76,7 @@ lazy_static = "1.4.0"
|
||||
log = "0.4.8"
|
||||
maplit = "1.0.1"
|
||||
notify = "4.0.14"
|
||||
opener = "0.4.1"
|
||||
rbx_binary = "0.5.0"
|
||||
rbx_dom_weak = "1.10.1"
|
||||
rbx_reflection = "3.3.408"
|
||||
|
||||
@@ -11,6 +11,7 @@ fn run(subcommand: Subcommand) -> Result<(), Box<dyn Error>> {
|
||||
Subcommand::Serve(serve_options) => cli::serve(serve_options)?,
|
||||
Subcommand::Build(build_options) => cli::build(build_options)?,
|
||||
Subcommand::Upload(upload_options) => cli::upload(upload_options)?,
|
||||
Subcommand::Doc => cli::doc()?,
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
||||
26
src/cli/doc.rs
Normal file
26
src/cli/doc.rs
Normal file
@@ -0,0 +1,26 @@
|
||||
use opener::{open, OpenError};
|
||||
use snafu::Snafu;
|
||||
|
||||
#[derive(Debug, Snafu)]
|
||||
pub struct DocError(Error);
|
||||
|
||||
#[derive(Debug, Snafu)]
|
||||
enum Error {
|
||||
Open { source: OpenError },
|
||||
}
|
||||
|
||||
impl From<OpenError> for Error {
|
||||
fn from(source: OpenError) -> Self {
|
||||
Error::Open { source }
|
||||
}
|
||||
}
|
||||
|
||||
pub fn doc() -> Result<(), DocError> {
|
||||
doc_inner()?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn doc_inner() -> Result<(), Error> {
|
||||
open("https://rojo.space/docs")?;
|
||||
Ok(())
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
//! Defines Rojo's CLI through structopt types.
|
||||
|
||||
mod build;
|
||||
mod doc;
|
||||
mod init;
|
||||
mod serve;
|
||||
mod upload;
|
||||
@@ -17,6 +18,7 @@ use std::{
|
||||
use structopt::StructOpt;
|
||||
|
||||
pub use self::build::*;
|
||||
pub use self::doc::*;
|
||||
pub use self::init::*;
|
||||
pub use self::serve::*;
|
||||
pub use self::upload::*;
|
||||
@@ -48,6 +50,9 @@ pub enum Subcommand {
|
||||
|
||||
/// Generates a place or model file out of the project and uploads it to Roblox.
|
||||
Upload(UploadCommand),
|
||||
|
||||
/// Open Rojo's documentation in your browser.
|
||||
Doc,
|
||||
}
|
||||
|
||||
/// Initializes a new Rojo project.
|
||||
|
||||
Reference in New Issue
Block a user