Initial commit

This commit is contained in:
Atlas Cove 2022-10-10 15:42:39 +00:00
commit 574d9b8668
5 changed files with 202 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/target

161
Cargo.lock generated Normal file
View File

@ -0,0 +1,161 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "autocfg"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
[[package]]
name = "bytecount"
version = "0.6.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2c676a478f63e9fa2dd5368a42f28bba0d6c560b775f38583c8bbaa7fcd67c9c"
[[package]]
name = "hashbrown"
version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
[[package]]
name = "indexmap"
version = "1.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "10a35a97730320ffe8e2d410b5d3b69279b98d2c14bdb8b70ea89ecf7888d41e"
dependencies = [
"autocfg",
"hashbrown",
"serde",
]
[[package]]
name = "indextree"
version = "4.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "497f036ac2fae75c34224648a77802e5dd4e9cfb56f4713ab6b12b7160a0523b"
[[package]]
name = "jetscii"
version = "0.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "47f142fe24a9c9944451e8349de0a56af5f3e7226dc46f3ed4d4ecc0b85af75e"
[[package]]
name = "lazy_static"
version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]]
name = "memchr"
version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d"
[[package]]
name = "minimal-lexical"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
[[package]]
name = "nom"
version = "7.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a8903e5a29a317527874d0402f867152a3d21c908bb0b933e416c65e301d4c36"
dependencies = [
"memchr",
"minimal-lexical",
]
[[package]]
name = "orgize"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e4998a8f863c00c06e18f83ed3c4de39e01f5a7ee5bddd072f0fb31bacfd7fa"
dependencies = [
"bytecount",
"indexmap",
"indextree",
"jetscii",
"lazy_static",
"memchr",
"nom",
"serde",
"serde_indextree",
]
[[package]]
name = "orgize-cli"
version = "0.1.0"
dependencies = [
"orgize",
]
[[package]]
name = "proc-macro2"
version = "1.0.46"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "94e2ef8dbfc347b10c094890f778ee2e36ca9bb4262e86dc99cd217e35f3470b"
dependencies = [
"unicode-ident",
]
[[package]]
name = "quote"
version = "1.0.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bbe448f377a7d6961e30f5955f9b8d106c3f5e449d493ee1b125c1d43c2b5179"
dependencies = [
"proc-macro2",
]
[[package]]
name = "serde"
version = "1.0.145"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "728eb6351430bccb993660dfffc5a72f91ccc1295abaa8ce19b27ebe4f75568b"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_derive"
version = "1.0.145"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "81fa1584d3d1bcacd84c277a0dfe21f5b0f6accf4a23d04d4c6d61f1af522b4c"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "serde_indextree"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a70e7d58005454b0ba863a8775df0c4391a8128c3a34974001de556d661bf74f"
dependencies = [
"indextree",
"serde",
]
[[package]]
name = "syn"
version = "1.0.102"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3fcd952facd492f9be3ef0d0b7032a6e442ee9b361d4acc2b1d0c4aaa5f613a1"
dependencies = [
"proc-macro2",
"quote",
"unicode-ident",
]
[[package]]
name = "unicode-ident"
version = "1.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6ceab39d59e4c9499d4e5a8ee0e2735b891bb7308ac83dfb4e80cad195c9f6f3"

12
Cargo.toml Normal file
View File

@ -0,0 +1,12 @@
[package]
name = "orgize-cli"
version = "0.1.0"
edition = "2021"
license = "GPL-3.0-or-later"
description = "A command-line wrapper for the Orgize library targeting HTML."
readme = "readme.md"
repository = "https://git.sr.ht/~atlas48/orgize-cli"
catagories = ["command-line-utilities"]
keywords = ["org-mode","cli"]
[dependencies]
orgize = "0.9.0"

10
readme.md Normal file
View File

@ -0,0 +1,10 @@
# `orgize-cli`
Invoke as `orgize`.
Orgize is a simple command-line filter to render your [org-mode](https://org-mode.org) files to html.
## Invocation
```sh
$ orgize < file.org > file.html
```

18
src/main.rs Normal file
View File

@ -0,0 +1,18 @@
use orgize::Org;
//use std::env;
use std::fs;
use std::io::{Read,Write};
// Currently acts as a simple filter.
fn main() {
let mut ibuf = String::new();
let mut obuf = Vec::new();
//TODO: Add filename support
/*let argv: Vec<String> = env::args().collect();
/let argc = argv.len();*/
let mut stdin = std::io::stdin();
if let Err(_) = stdin.read_to_string(&mut buf) {
eprintln!("Unable to read stdin.");
}
Org::parse_string(ibuf).write_html(stdout)?;
}