This commit is contained in:
despiegk 2025-04-09 09:47:16 +02:00
parent 60e688810d
commit 28a7ef3a94
6 changed files with 29 additions and 10 deletions

View File

@ -79,12 +79,12 @@ FLAGS:
-V, --version Prints version information
SUBCOMMANDS:
delete-collection Delete a collection from Redis
delete Delete a collection
get Get page content
html Get page content as HTML
info Show detailed information about collections
list List collections
reset Delete all collections from Redis
reset Delete all 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
```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
@ -144,7 +144,7 @@ This command deletes a collection from Redis.
doctreecmd reset --doctree my_doctree
```
This command deletes all collections from Redis.
This command deletes all collections.
## Implementation Details

15
build.sh Executable file
View 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!"

View File

@ -3,6 +3,10 @@ name = "doctreecmd"
version = "0.1.0"
edition = "2024"
[[bin]]
name = "doctree"
path = "src/main.rs"
[dependencies]
doctree = { path = "../doctree" }
clap = "3.2.25"

View File

@ -3,7 +3,7 @@ use doctree::{DocTree, RedisStorage, Result, from_directory};
use std::path::Path;
fn main() -> Result<()> {
let matches = App::new("DocTree CLI")
let matches = App::new("doctree")
.version("0.1.0")
.author("Your Name")
.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')")),
)
.subcommand(
SubCommand::with_name("delete-collection")
SubCommand::with_name("delete")
.about("Delete a collection from Redis")
.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')")),
@ -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 doctree_name = matches.value_of("doctree").unwrap_or("default");

View File

@ -19,7 +19,7 @@ echo -e "\n=== Getting Document (HTML) ==="
cargo run -- get -c grid_documentation -p introduction.md -f html
echo -e "\n=== Deleting Collection ==="
cargo run -- delete-collection grid_documentation
cargo run -- delete grid_documentation
echo -e "\n=== Listing Remaining Collections ==="
cargo run -- list

View File

@ -24,7 +24,7 @@ cargo run -- get -p 01_features.md --doctree supercollection
# Delete a specific collection
echo -e "\n=== Deleting Collection ==="
cargo run -- delete-collection grid_documentation --doctree supercollection
cargo run -- delete grid_documentation --doctree supercollection
# List remaining collections
echo -e "\n=== Listing Remaining Collections ==="