Skip to content

Commit

Permalink
Rename forc doc --manifest-path to --path
Browse files Browse the repository at this point in the history
  • Loading branch information
amiremohamadi committed Dec 20, 2024
1 parent 192f163 commit 32c1955
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions forc-plugins/forc-doc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ $ cargo install --path forc-plugins/forc-doc
Great! Let's check everything is working as intended. Try running `forc doc` on one of the test directories:

```sh
$ forc doc --manifest-path src/tests/data/impl_traits --open
$ forc doc --path src/tests/data/impl_traits --open
```

If it succeeded, you should be seeing the test docs in your browser.
Expand Down Expand Up @@ -274,10 +274,10 @@ Now we can call this function anytime we need to generate a searchbar for our we
Once you've made some changes, run the `forc doc` binary, passing it a path containing a `Forc.toml`:

```sh
cargo run -- --manifest-path path/to/manifest --open
cargo run -- --path path/to/manifest --open
```

> **Tip:** VS Code user? Try the Live Server plugin to make viewing changes even easier. It will reload a webpage on updates, so you only need to rebuild the docs (`cargo run -- --manifest-path path/to/manifest`). Just right click the index file of docs produced by `forc doc` which can be found in the `out/doc` directory, and choose the option "open with Live Server". Voila!
> **Tip:** VS Code user? Try the Live Server plugin to make viewing changes even easier. It will reload a webpage on updates, so you only need to rebuild the docs (`cargo run -- --path path/to/manifest`). Just right click the index file of docs produced by `forc doc` which can be found in the `out/doc` directory, and choose the option "open with Live Server". Voila!
[forc-reference]: https://fuellabs.github.io/sway/master/book/forc/index.html "forc reference"
[manifest-reference]: https://fuellabs.github.io/sway/master/book/forc/manifest_reference.html "manifest reference"
Expand Down
6 changes: 3 additions & 3 deletions forc-plugins/forc-doc/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ forc_util::cli_examples! {
crate::cli::Command {
[ Build the docs for a project in the current path => "forc doc"]
[ Build the docs for a project in the current path and open it in the browser => "forc doc --open" ]
[ Build the docs for a project located in another path => "forc doc --manifest-path {path}" ]
[ Build the docs for a project located in another path => "forc doc --path {path}" ]
[ Build the docs for the current project exporting private types => "forc doc --document-private-items" ]
[ Build the docs offline without downloading any dependency from the network => "forc doc --offline" ]
}
Expand All @@ -22,8 +22,8 @@ forc_util::cli_examples! {
pub struct Command {
/// Path to the Forc.toml file. By default, forc-doc searches for the Forc.toml
/// file in the current directory or any parent directory.
#[clap(long)]
pub manifest_path: Option<String>,
#[clap(long, alias = "manifest-path")]
pub path: Option<String>,
/// Include non-public items in the documentation.
#[clap(long)]
pub document_private_items: bool,
Expand Down
2 changes: 1 addition & 1 deletion forc-plugins/forc-doc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ pub fn compile_html(
get_doc_dir: &dyn Fn(&Command) -> String,
) -> Result<(PathBuf, Box<PackageManifestFile>)> {
// get manifest directory
let dir = if let Some(ref path) = build_instructions.manifest_path {
let dir = if let Some(ref path) = build_instructions.path {
PathBuf::from(path)
} else {
std::env::current_dir()?
Expand Down
4 changes: 2 additions & 2 deletions forc-plugins/forc-doc/src/tests/expects/impl_trait/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ fn test_impl_traits_default() {
let doc_dir_name: &str = "impl_traits_default";
let project_name = "impl_traits";
let command = Command {
manifest_path: Some(format!("{}/{}", DATA_DIR, project_name)),
path: Some(format!("{}/{}", DATA_DIR, project_name)),
doc_path: Some(doc_dir_name.into()),
..Default::default()
};
Expand Down Expand Up @@ -171,7 +171,7 @@ fn test_impl_traits_no_deps() {
let doc_dir_name: &str = "impl_traits_no_deps";
let project_name: &str = "impl_traits_clone";
let command = Command {
manifest_path: Some(format!("{}/{}", DATA_DIR, project_name)),
path: Some(format!("{}/{}", DATA_DIR, project_name)),
doc_path: Some(doc_dir_name.into()),
no_deps: true,
..Default::default()
Expand Down
4 changes: 2 additions & 2 deletions forc-plugins/forc-doc/tests/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ use std::path::Path;
fn builds_lib_std_docs() {
let path = Path::new("./../../sway-lib-std");
let build_instructions = Command {
manifest_path: Some(path.to_str().unwrap().to_string()),
path: Some(path.to_str().unwrap().to_string()),
..Default::default()
};
println!("Building docs for {:?}", build_instructions.manifest_path);
println!("Building docs for {:?}", build_instructions.path);
let res = compile_html(&build_instructions, &get_doc_dir);
assert!(res.is_ok());
}

0 comments on commit 32c1955

Please sign in to comment.