Commit 0ddefcd7b3
Unregistered key
Layout: unified · split
.gitignore +1
| @@ -1,2 +1,3 @@ | |||
| 1 | /target | 1 | /target |
| 2 | /TODO | 2 | /TODO |
| 3 | /docs/iamb.[15] | ||
Cargo.lock +39 −1
| @@ -867,6 +867,12 @@ version = "0.4.3" | |||
| 867 | source = "registry+https://github.com/rust-lang/crates.io-index" | 867 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 868 | checksum = "850878694b7933ca4c9569d30a34b55031b9b139ee1fc7b94a527c4ef960d690" | 868 | checksum = "850878694b7933ca4c9569d30a34b55031b9b139ee1fc7b94a527c4ef960d690" |
| 869 | 869 | ||
| 870 | [[package]] | ||
| 871 | name = "deunicode" | ||
| 872 | version = "1.3.3" | ||
| 873 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 874 | checksum = "8c1bba4f227a4a53d12b653f50ca7bf10c9119ae2aba56aff9e0338b5c98f36a" | ||
| 875 | |||
| 870 | [[package]] | 876 | [[package]] |
| 871 | name = "digest" | 877 | name = "digest" |
| 872 | version = "0.9.0" | 878 | version = "0.9.0" |
| @@ -1298,6 +1304,15 @@ dependencies = [ | |||
| 1298 | "windows 0.43.0", | 1304 | "windows 0.43.0", |
| 1299 | ] | 1305 | ] |
| 1300 | 1306 | ||
| 1307 | [[package]] | ||
| 1308 | name = "getopts" | ||
| 1309 | version = "0.2.21" | ||
| 1310 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 1311 | checksum = "14dbbfd5c71d70241ecf9e6f13737f7b5ce823821063188d7e46c41d371eebd5" | ||
| 1312 | dependencies = [ | ||
| 1313 | "unicode-width", | ||
| 1314 | ] | ||
| 1315 | |||
| 1301 | [[package]] | 1316 | [[package]] |
| 1302 | name = "getrandom" | 1317 | name = "getrandom" |
| 1303 | version = "0.1.16" | 1318 | version = "0.1.16" |
| @@ -1511,6 +1526,7 @@ dependencies = [ | |||
| 1511 | "html5ever", | 1526 | "html5ever", |
| 1512 | "image", | 1527 | "image", |
| 1513 | "lazy_static 1.4.0", | 1528 | "lazy_static 1.4.0", |
| 1529 | "mandown", | ||
| 1514 | "markup5ever_rcdom", | 1530 | "markup5ever_rcdom", |
| 1515 | "matrix-sdk", | 1531 | "matrix-sdk", |
| 1516 | "mime", | 1532 | "mime", |
| @@ -1830,6 +1846,16 @@ dependencies = [ | |||
| 1830 | "libc", | 1846 | "libc", |
| 1831 | ] | 1847 | ] |
| 1832 | 1848 | ||
| 1849 | [[package]] | ||
| 1850 | name = "mandown" | ||
| 1851 | version = "0.1.3" | ||
| 1852 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 1853 | checksum = "12243a468e9660b178540f73c43bdc544d64bd3cde749de0bd851e0dbacfd683" | ||
| 1854 | dependencies = [ | ||
| 1855 | "deunicode 1.3.3", | ||
| 1856 | "pulldown-cmark", | ||
| 1857 | ] | ||
| 1858 | |||
| 1833 | [[package]] | 1859 | [[package]] |
| 1834 | name = "maplit" | 1860 | name = "maplit" |
| 1835 | version = "1.0.2" | 1861 | version = "1.0.2" |
| @@ -2599,6 +2625,18 @@ dependencies = [ | |||
| 2599 | "syn 1.0.109", | 2625 | "syn 1.0.109", |
| 2600 | ] | 2626 | ] |
| 2601 | 2627 | ||
| 2628 | [[package]] | ||
| 2629 | name = "pulldown-cmark" | ||
| 2630 | version = "0.9.3" | ||
| 2631 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| 2632 | checksum = "77a1a2f1f0a7ecff9c31abbe177637be0e97a0aef46cf8738ece09327985d998" | ||
| 2633 | dependencies = [ | ||
| 2634 | "bitflags 1.3.2", | ||
| 2635 | "getopts", | ||
| 2636 | "memchr", | ||
| 2637 | "unicase", | ||
| 2638 | ] | ||
| 2639 | |||
| 2602 | [[package]] | 2640 | [[package]] |
| 2603 | name = "quick-xml" | 2641 | name = "quick-xml" |
| 2604 | version = "0.28.1" | 2642 | version = "0.28.1" |
| @@ -3367,7 +3405,7 @@ version = "0.1.4" | |||
| 3367 | source = "registry+https://github.com/rust-lang/crates.io-index" | 3405 | source = "registry+https://github.com/rust-lang/crates.io-index" |
| 3368 | checksum = "b3bc762e6a4b6c6fcaade73e77f9ebc6991b676f88bb2358bddb56560f073373" | 3406 | checksum = "b3bc762e6a4b6c6fcaade73e77f9ebc6991b676f88bb2358bddb56560f073373" |
| 3369 | dependencies = [ | 3407 | dependencies = [ |
| 3370 | "deunicode", | 3408 | "deunicode 0.4.3", |
| 3371 | ] | 3409 | ] |
| 3372 | 3410 | ||
| 3373 | [[package]] | 3411 | [[package]] |
Cargo.toml +3
| @@ -14,6 +14,9 @@ categories = ["command-line-utilities"] | |||
| 14 | rust-version = "1.66" | 14 | rust-version = "1.66" |
| 15 | build = "build.rs" | 15 | build = "build.rs" |
| 16 | 16 | ||
| 17 | [build-dependencies] | ||
| 18 | mandown = "0.1.3" | ||
| 19 | |||
| 17 | [build-dependencies.vergen] | 20 | [build-dependencies.vergen] |
| 18 | version = "8" | 21 | version = "8" |
| 19 | default-features = false | 22 | default-features = false |
build.rs +19
| @@ -1,7 +1,26 @@ | |||
| 1 | use std::error::Error; | 1 | use std::error::Error; |
| 2 | use std::fs; | ||
| 3 | use std::iter::FromIterator; | ||
| 4 | use std::path::PathBuf; | ||
| 5 | |||
| 6 | use mandown::convert; | ||
| 2 | use vergen::EmitBuilder; | 7 | use vergen::EmitBuilder; |
| 3 | 8 | ||
| 9 | const IAMB_1_MD: &str = include_str!("docs/iamb.1.md"); | ||
| 10 | const IAMB_5_MD: &str = include_str!("docs/iamb.5.md"); | ||
| 11 | |||
| 4 | fn main() -> Result<(), Box<dyn Error>> { | 12 | fn main() -> Result<(), Box<dyn Error>> { |
| 5 | EmitBuilder::builder().git_sha(true).emit()?; | 13 | EmitBuilder::builder().git_sha(true).emit()?; |
| 14 | |||
| 15 | // Build the manual pages. | ||
| 16 | println!("cargo:rerun-if-changed=docs/iamb.1.md"); | ||
| 17 | println!("cargo:rerun-if-changed=docs/iamb.5.md"); | ||
| 18 | |||
| 19 | let iamb_1 = convert(IAMB_1_MD, "IAMB", 1); | ||
| 20 | let iamb_5 = convert(IAMB_5_MD, "IAMB", 5); | ||
| 21 | |||
| 22 | fs::write(PathBuf::from_iter(["docs", "iamb.1"]), iamb_1.as_bytes())?; | ||
| 23 | fs::write(PathBuf::from_iter(["docs", "iamb.5"]), iamb_5.as_bytes())?; | ||
| 24 | |||
| 6 | Ok(()) | 25 | Ok(()) |
| 7 | } | 26 | } |
docs/example_config.json added +32
| @@ -0,0 +1,32 @@ | |||
| 1 | { | ||
| 2 | "default_profile": "default", | ||
| 3 | "profiles": { | ||
| 4 | "default": { | ||
| 5 | "user_id": "", | ||
| 6 | "url": "https://matrix.org", | ||
| 7 | "settings": {}, | ||
| 8 | "dirs": {} | ||
| 9 | } | ||
| 10 | }, | ||
| 11 | "settings": { | ||
| 12 | "log_level": "warn", | ||
| 13 | "reaction_display": true, | ||
| 14 | "reaction_shortcode_display": false, | ||
| 15 | "read_receipt_send": true, | ||
| 16 | "read_receipt_display": true, | ||
| 17 | "request_timeout": 10000, | ||
| 18 | "typing_notice_send": true, | ||
| 19 | "typing_notice_display": true, | ||
| 20 | "users": { | ||
| 21 | "@user:matrix.org": { | ||
| 22 | "name": "John Doe", | ||
| 23 | "color": "magenta" | ||
| 24 | } | ||
| 25 | }, | ||
| 26 | "default_room": "#iamb-users:0x.badd.cafe" | ||
| 27 | }, | ||
| 28 | "dirs": { | ||
| 29 | "cache": "~/.cache/iamb/", | ||
| 30 | "logs": "~/.local/share/iamb/logs/", | ||
| 31 | "downloads": "~/Downloads/" | ||
| 32 | } | ||
docs/iamb.1.md added +29
| @@ -0,0 +1,29 @@ | |||
| 1 | # NAME | ||
| 2 | |||
| 3 | iamb – a terminal-based client for Matrix for the Vim addict | ||
| 4 | |||
| 5 | # SYNOPSIS | ||
| 6 | |||
| 7 | **iamb** [**--profile** _profile_] [**--config-directory** _directory_] [**--help** | **--version**] | ||
| 8 | |||
| 9 | # OPTIONS | ||
| 10 | |||
| 11 | These options are primitives at the top-level of the file. | ||
| 12 | |||
| 13 | **--profile**, **-P** | ||
| 14 | > The profile to start with. Overrides **default_profile** from **iamb(5)**. | ||
| 15 | |||
| 16 | **--config-directory**, **-C** | ||
| 17 | > Path to the directory the configuration file is located in. | ||
| 18 | |||
| 19 | **--help**, **-h** | ||
| 20 | > Show a short help text and quit. | ||
| 21 | |||
| 22 | **--version**, **-V** | ||
| 23 | > Show the iamb version and quit. | ||
| 24 | |||
| 25 | # SEE ALSO | ||
| 26 | |||
| 27 | **iamb(5)** | ||
| 28 | |||
| 29 | Full documentation is available online at \<https://iamb.chat\> | ||
docs/iamb.5.md added +113
| @@ -0,0 +1,113 @@ | |||
| 1 | # NAME | ||
| 2 | |||
| 3 | config.json – configuration file for iamb | ||
| 4 | |||
| 5 | # SYNOPSIS | ||
| 6 | |||
| 7 | Configuration must be placed under _~/.config/iamb/_ and is named config.json. | ||
| 8 | |||
| 9 | Example configuration usually comes bundled with your installation and can | ||
| 10 | typically be found in _/usr/share/iamb_. | ||
| 11 | |||
| 12 | As implied by the filename, the configuration is formatted in JSON. It's | ||
| 13 | structure and fields are described below. | ||
| 14 | |||
| 15 | # BASIC SETTINGS | ||
| 16 | |||
| 17 | These options are primitives at the top-level of the file. | ||
| 18 | |||
| 19 | **default_profile** (type: string) | ||
| 20 | > The default profile to connect to, unless overwritten by a commandline | ||
| 21 | > switch. It has to be defined in the *PROFILES* section. | ||
| 22 | |||
| 23 | # PROFILES | ||
| 24 | |||
| 25 | These options are configured as a map under the profiles name. | ||
| 26 | |||
| 27 | **user_id** (type: string) | ||
| 28 | > The user ID to use when connecting to the server. For example "user" for | ||
| 29 | > "@user:matrix.org". | ||
| 30 | |||
| 31 | **url** (type: string) | ||
| 32 | > The URL of the users server. For example "https://matrix.org" for | ||
| 33 | > "@user:matrix.org". | ||
| 34 | |||
| 35 | **settings** (type: settings object) | ||
| 36 | > Overwrite general settings for this account. The fields are identical to | ||
| 37 | > those in *TUNABLES*. | ||
| 38 | |||
| 39 | **dirs** (type: XDG overrides object) | ||
| 40 | > Overwrite general settings for this account. The fields are identical to | ||
| 41 | > those in *DIRECTORIES*. | ||
| 42 | |||
| 43 | # TUNABLES | ||
| 44 | |||
| 45 | These options are configured as a map under the *settings* key and can be | ||
| 46 | overridden as described in *PROFILES*. | ||
| 47 | |||
| 48 | **log_level** (type: string) | ||
| 49 | > Specifies the lowest log level that should be shown. Possible values | ||
| 50 | > are: _trace_, _debug_, _info_, _warn_, and _error_. | ||
| 51 | |||
| 52 | **reaction_display** (type: boolean) | ||
| 53 | > Defines whether or not reactions should be shown. | ||
| 54 | |||
| 55 | **reaction_shortcode_display** (type: boolean) | ||
| 56 | > Defines whether or not reactions should be shown as their respective | ||
| 57 | > shortcode. | ||
| 58 | |||
| 59 | **read_receipt_send** (type: boolean) | ||
| 60 | > Defines whether or not read confirmations are sent. | ||
| 61 | |||
| 62 | **read_receipt_display** (type: boolean) | ||
| 63 | > Defines whether or not read confirmations are displayed. | ||
| 64 | |||
| 65 | **request_timeout** (type: uint64) | ||
| 66 | > Defines the maximum time per request in seconds. | ||
| 67 | |||
| 68 | **typing_notice_send** (type: boolean) | ||
| 69 | > Defines whether or not the typing state is sent. | ||
| 70 | |||
| 71 | **typing_notice_display** (type: boolean) | ||
| 72 | > Defines whether or not the typing state is displayed. | ||
| 73 | |||
| 74 | **user** (type: map) | ||
| 75 | > Overrides values for the specified user. See *USER OVERRIDES* for | ||
| 76 | > details on the format. | ||
| 77 | |||
| 78 | **default_room** (type: string) | ||
| 79 | > The room to show by default instead of a welcome-screen. | ||
| 80 | |||
| 81 | ## USER OVERRIDES | ||
| 82 | |||
| 83 | Overrides are mapped onto matrix User IDs such as _@user:matrix.org_ and are | ||
| 84 | maps containing the following key value pairs. | ||
| 85 | |||
| 86 | **name** (type: string) | ||
| 87 | > Change the display name of the user. | ||
| 88 | |||
| 89 | **color** (type: string) | ||
| 90 | > Change the color the user is shown as. Possible values are: _black_, | ||
| 91 | > _blue_, _cyan_, _dark-gray_, _gray_, _green_, _light-blue_, | ||
| 92 | > _light-cyan_, _light-green_, _light-magenta_, _light-red_, | ||
| 93 | > _light-yellow_, _magenta_, _none_, _red_, _white_, _yellow_ | ||
| 94 | |||
| 95 | # DIRECTORIES | ||
| 96 | |||
| 97 | Specifies the directories to save data in. Configured as a map under the key | ||
| 98 | *dirs*. | ||
| 99 | |||
| 100 | **cache** (type: string) | ||
| 101 | > Specifies where to store assets and temporary data in. | ||
| 102 | |||
| 103 | **logs** (type: string) | ||
| 104 | > Specifies where to store log files. | ||
| 105 | |||
| 106 | **downloads** (type: string) | ||
| 107 | > Specifies where to store downloaded files. | ||
| 108 | |||
| 109 | # SEE ALSO | ||
| 110 | |||
| 111 | *iamb(1)* | ||
| 112 | |||
| 113 | Full documentation is available online at \<https://iamb.chat\> | ||