diff --git a/README.md b/README.md new file mode 100644 index 0000000..69a2edc --- /dev/null +++ b/README.md @@ -0,0 +1,47 @@ +# Wiki Maker + +## How to use + +### Creation + +> [!NOTE] See the example in [example/](./example/). + +wiki-maker provides a CLI to help create a wiki. + +You can generate an entry with: +```sh +wiki-maker entry new "My New Entry" +``` + +An entry is made of essencially 2 files: +- `my-new-entry.toml` contains the names of the other files, as well as a map of attributes for your entry +- `my-new-entry.md` is where you start writing +- By default it looks for `my-new-entry.png` as the main image. + +Links are made between entries by using this syntax: `[See this entry](my-other-entry)`. +You can view which links are not yet satisfied with: +```sh +wiki-maker todo +``` + +You can even generate a graph representation of your wiki: +```sh +wiki-maker graph | dot -Tpng > /tmp/graph.png +imv /tmp/graph.png +``` + +### Deployment + +wiki-maker provides 2 ways to deploy your wiki. + +You can serve the wiki in `example` with: +```sh +wiki-maker --path ./example/ serve --port 8090 --host +``` + +> [!NOTE] Changes to files will instantly reflect on the server. + +Or you can generate a static build with: +```sh +wiki-maker --path ./example/ build -o ./dist/ +``` diff --git a/src/cli.rs b/src/cli.rs index f1eef9f..3072ce2 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -15,10 +15,13 @@ pub struct Cli { pub enum Commands { /// Serve the wiki locally Serve { + /// Disable the navigation page #[arg(short, long)] no_navigation: bool, + /// Network port to use #[arg(short = 'P', long, default_value = "8090")] port: u16, + /// Whether to use 0.0.0.0 to serve on the network #[arg(short = 'H', long)] host: bool, }, diff --git a/src/main.rs b/src/main.rs index f3f0f56..d48c349 100644 --- a/src/main.rs +++ b/src/main.rs @@ -115,6 +115,9 @@ async fn main() -> anyhow::Result<()> { }; let listener = tokio::net::TcpListener::bind(&addr).await?; tracing::info!("Listening on http://{}", addr); + if no_navigation { + tracing::warn!("no_navigation is enabled: there will be no index at the root") + } axum::serve(listener, app).await?; } Commands::Build {