Skip to content

Commit c4b7c35

Browse files
committed
Add build command to the rust source code
1 parent f531446 commit c4b7c35

2 files changed

Lines changed: 7 additions & 12 deletions

File tree

cli/entrypoint.sh

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ if [ "$COMMAND" = "generate" ]; then
1212
if [ -n "$INPUT_PATH" ]; then
1313
CMD="$CMD $INPUT_PATH"
1414
fi
15-
elif [ "$COMMAND" = "docs" ]; then
15+
elif [ "$COMMAND" = "docs" ] || [ "$COMMAND" = "build" ]; then
1616
PATH_VAL="${INPUT_PATH:-output/docs}"
1717
# If index path is set, we must provide path
1818
if [ -n "$INPUT_INDEX_PATH" ]; then
@@ -22,17 +22,6 @@ elif [ "$COMMAND" = "docs" ]; then
2222
CMD="$CMD $INPUT_PATH"
2323
fi
2424

25-
if [ -n "$INPUT_PAGE_SIZE" ]; then
26-
CMD="$CMD --page-size $INPUT_PAGE_SIZE"
27-
fi
28-
elif [ "$COMMAND" = "build" ]; then
29-
INDEX_PATH="${INPUT_INDEX_PATH:-output/index.json}"
30-
DOCS_PATH="${INPUT_PATH:-output/docs}"
31-
32-
echo "Running: luna_cli generate $INDEX_PATH"
33-
luna_cli generate "$INDEX_PATH" || exit 1
34-
35-
CMD="luna_cli docs $DOCS_PATH $INDEX_PATH"
3625
if [ -n "$INPUT_PAGE_SIZE" ]; then
3726
CMD="$CMD --page-size $INPUT_PAGE_SIZE"
3827
fi

cli/src/main.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ enum Commands {
3737
},
3838
/// Generate documentation for the current index file
3939
Docs(DocsArgs),
40+
/// Generate an index file and documentation
41+
Build(DocsArgs),
4042
}
4143

4244
#[derive(Args, Clone)]
@@ -74,6 +76,10 @@ fn main() -> Result<()> {
7476
match &cli.command {
7577
Commands::Generate { path } => generate(path.to_owned())?,
7678
Commands::Docs(args) => docs(args.path.to_owned(), args.index.to_owned(), args.page_size)?,
79+
Commands::Build(args) => {
80+
generate(args.index.to_owned())?;
81+
docs(args.path.to_owned(), args.index.to_owned(), args.page_size)?;
82+
}
7783
Commands::Index { args, path } => {
7884
let index_content = std::fs::read_to_string(path)
7985
.with_context(|| format!("Could not read index file {path}"))?;

0 commit comments

Comments
 (0)