...
This commit is contained in:
parent
60e688810d
commit
28a7ef3a94
10
README.md
10
README.md
@ -79,12 +79,12 @@ FLAGS:
|
|||||||
-V, --version Prints version information
|
-V, --version Prints version information
|
||||||
|
|
||||||
SUBCOMMANDS:
|
SUBCOMMANDS:
|
||||||
delete-collection Delete a collection from Redis
|
delete Delete a collection
|
||||||
get Get page content
|
get Get page content
|
||||||
html Get page content as HTML
|
html Get page content as HTML
|
||||||
info Show detailed information about collections
|
info Show detailed information about collections
|
||||||
list List collections
|
list List collections
|
||||||
reset Delete all collections from Redis
|
reset Delete all collections
|
||||||
scan Scan a directory for .collection files and create collections
|
scan Scan a directory for .collection files and create collections
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -133,10 +133,10 @@ This command shows detailed information about a collection, including its docume
|
|||||||
#### Deleting a Collection
|
#### Deleting a Collection
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
doctreecmd delete-collection collection_name --doctree my_doctree
|
doctreecmd delete collection_name --doctree my_doctree
|
||||||
```
|
```
|
||||||
|
|
||||||
This command deletes a collection from Redis.
|
This command deletes a collection.
|
||||||
|
|
||||||
#### Resetting All Collections
|
#### Resetting All Collections
|
||||||
|
|
||||||
@ -144,7 +144,7 @@ This command deletes a collection from Redis.
|
|||||||
doctreecmd reset --doctree my_doctree
|
doctreecmd reset --doctree my_doctree
|
||||||
```
|
```
|
||||||
|
|
||||||
This command deletes all collections from Redis.
|
This command deletes all collections.
|
||||||
|
|
||||||
## Implementation Details
|
## Implementation Details
|
||||||
|
|
||||||
|
15
build.sh
Executable file
15
build.sh
Executable file
@ -0,0 +1,15 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Change to the directory where the script is located
|
||||||
|
cd "$(dirname "$0")"
|
||||||
|
# Exit immediately if a command exits with a non-zero status
|
||||||
|
set -e
|
||||||
|
|
||||||
|
echo "Building doctree binary..."
|
||||||
|
cd doctreecmd
|
||||||
|
cargo build --release
|
||||||
|
|
||||||
|
echo "Copying doctree binary to ~/hero/bin/"
|
||||||
|
mkdir -p ~/hero/bin/
|
||||||
|
cp target/release/doctree ~/hero/bin/
|
||||||
|
|
||||||
|
echo "Build and installation complete!"
|
@ -3,6 +3,10 @@ name = "doctreecmd"
|
|||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
|
|
||||||
|
[[bin]]
|
||||||
|
name = "doctree"
|
||||||
|
path = "src/main.rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
doctree = { path = "../doctree" }
|
doctree = { path = "../doctree" }
|
||||||
clap = "3.2.25"
|
clap = "3.2.25"
|
||||||
|
@ -3,7 +3,7 @@ use doctree::{DocTree, RedisStorage, Result, from_directory};
|
|||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
|
||||||
fn main() -> Result<()> {
|
fn main() -> Result<()> {
|
||||||
let matches = App::new("DocTree CLI")
|
let matches = App::new("doctree")
|
||||||
.version("0.1.0")
|
.version("0.1.0")
|
||||||
.author("Your Name")
|
.author("Your Name")
|
||||||
.about("A tool to manage document collections")
|
.about("A tool to manage document collections")
|
||||||
@ -53,7 +53,7 @@ fn main() -> Result<()> {
|
|||||||
.arg(Arg::with_name("doctree").long("doctree").takes_value(true).help("Name of the doctree (default: 'default')")),
|
.arg(Arg::with_name("doctree").long("doctree").takes_value(true).help("Name of the doctree (default: 'default')")),
|
||||||
)
|
)
|
||||||
.subcommand(
|
.subcommand(
|
||||||
SubCommand::with_name("delete-collection")
|
SubCommand::with_name("delete")
|
||||||
.about("Delete a collection from Redis")
|
.about("Delete a collection from Redis")
|
||||||
.arg(Arg::with_name("collection").required(true).help("Name of the collection"))
|
.arg(Arg::with_name("collection").required(true).help("Name of the collection"))
|
||||||
.arg(Arg::with_name("doctree").long("doctree").takes_value(true).help("Name of the doctree (default: 'default')")),
|
.arg(Arg::with_name("doctree").long("doctree").takes_value(true).help("Name of the doctree (default: 'default')")),
|
||||||
@ -266,7 +266,7 @@ fn main() -> Result<()> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if let Some(matches) = matches.subcommand_matches("delete-collection") {
|
} else if let Some(matches) = matches.subcommand_matches("delete") {
|
||||||
let collection = matches.value_of("collection").unwrap();
|
let collection = matches.value_of("collection").unwrap();
|
||||||
let doctree_name = matches.value_of("doctree").unwrap_or("default");
|
let doctree_name = matches.value_of("doctree").unwrap_or("default");
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ echo -e "\n=== Getting Document (HTML) ==="
|
|||||||
cargo run -- get -c grid_documentation -p introduction.md -f html
|
cargo run -- get -c grid_documentation -p introduction.md -f html
|
||||||
|
|
||||||
echo -e "\n=== Deleting Collection ==="
|
echo -e "\n=== Deleting Collection ==="
|
||||||
cargo run -- delete-collection grid_documentation
|
cargo run -- delete grid_documentation
|
||||||
|
|
||||||
echo -e "\n=== Listing Remaining Collections ==="
|
echo -e "\n=== Listing Remaining Collections ==="
|
||||||
cargo run -- list
|
cargo run -- list
|
||||||
|
@ -24,7 +24,7 @@ cargo run -- get -p 01_features.md --doctree supercollection
|
|||||||
|
|
||||||
# Delete a specific collection
|
# Delete a specific collection
|
||||||
echo -e "\n=== Deleting Collection ==="
|
echo -e "\n=== Deleting Collection ==="
|
||||||
cargo run -- delete-collection grid_documentation --doctree supercollection
|
cargo run -- delete grid_documentation --doctree supercollection
|
||||||
|
|
||||||
# List remaining collections
|
# List remaining collections
|
||||||
echo -e "\n=== Listing Remaining Collections ==="
|
echo -e "\n=== Listing Remaining Collections ==="
|
||||||
|
Loading…
Reference in New Issue
Block a user