Compare commits

...

33 commits
v0.1.0 ... main

Author SHA1 Message Date
4bbffbbdd8
Update all dependencies
Lots of breaking changes in clap
2023-03-02 00:16:01 +02:00
8401602f32
Conver build-release to POSIX sh and fix issues reported by shellcheck 2023-03-01 22:21:15 +02:00
87ccec2f5a
Update dotfile link 2022-06-12 12:26:12 +03:00
6f513d0dd9
Update releases url 2022-06-12 12:01:01 +03:00
f1502551d8
Update information about releases 2022-06-12 11:59:59 +03:00
eb3398f044
Fix typo in build-release.sh 2022-06-12 11:52:47 +03:00
e262e9a506
Add manpage 2022-06-12 11:48:51 +03:00
78cc2ba87d
Use recommended AsciiDoc style of blank lines after section title 2022-06-12 11:25:44 +03:00
493ca5139e
Convert README to AsciiDoc 2022-06-12 11:16:28 +03:00
66b4093440
Update usernames in some links 2020-12-04 18:44:30 +02:00
Marko Korhonen
a753dad9f5
Add information about --copy-config 2020-01-22 00:49:25 +02:00
Marko Korhonen
7fa060e896
Fix indentation 2020-01-22 00:47:22 +02:00
Marko Korhonen
b15845c62d
Small fixes 2020-01-22 00:45:04 +02:00
Marko Korhonen
b707a29881
Move releases section 2020-01-22 00:39:54 +02:00
Marko Korhonen
4ecd409c27
Add information about release notes 2020-01-22 00:38:15 +02:00
Marko Korhonen
213ac33139
Added release build script 2020-01-22 00:30:39 +02:00
Marko Korhonen
34a4ad9974
Update dependencies 2020-01-21 23:03:53 +02:00
Marko Korhonen
5e995c3549
Update version 2020-01-21 23:03:45 +02:00
Marko Korhonen
86fb3eed8c
Moved binaries to GitHub 2020-01-21 22:39:58 +02:00
Marko Korhonen
b17bc4a449
Do not overwrite with --copy-config 2020-01-21 22:21:24 +02:00
Marko Korhonen
425cfb3078 Merge branch 'dev' of ReekyMarko/lqsd into master 2020-01-21 21:54:50 +02:00
Marko Korhonen
9740b62d5d
Update usage 2020-01-21 21:50:19 +02:00
Marko Korhonen
28f1bc021a
Ignore unused variable 2020-01-21 21:50:03 +02:00
Marko Korhonen
46092dfe3a
Use default value if key is missing 2020-01-21 21:43:18 +02:00
Marko Korhonen
1a016546d8
Improve error handling 2020-01-21 21:00:09 +02:00
Marko Korhonen
c1878b1fab
Better error handling
Now when the configuration file fails to read/parse, we use default
config
2020-01-21 20:59:29 +02:00
Marko Korhonen
afe4572988
Added --copy-config and set order within help 2020-01-21 20:59:06 +02:00
Marko Korhonen
242c982565
Begin working on more graceful error handling
NOTE: This does not work currently

Signed-off-by: Marko Korhonen <marko.korhonen@reekynet.com>
2020-01-21 17:22:17 +02:00
Marko Korhonen
04e23c6144
Move conf struct to config.rs and impl Default
Signed-off-by: Marko Korhonen <marko.korhonen@reekynet.com>
2020-01-20 21:22:49 +02:00
Marko Korhonen
6404ae7463
Add information about dependencies and building
Signed-off-by: Marko Korhonen <marko.korhonen@reekynet.com>
2020-01-20 19:51:35 +02:00
Marko Korhonen
4a440f22b5
Fix typo in license file name
Signed-off-by: Marko Korhonen <marko.korhonen@reekynet.com>
2020-01-20 19:45:43 +02:00
Marko Korhonen
25db397560
Small fixes to readme
Signed-off-by: Marko Korhonen <marko.korhonen@reekynet.com>
2020-01-20 02:02:32 +02:00
Marko Korhonen
a807ef3ee2
Add info about prebuilt binaries
Signed-off-by: Marko Korhonen <marko.korhonen@reekynet.com>
2020-01-20 00:12:26 +02:00
11 changed files with 697 additions and 201 deletions

1
.gitignore vendored
View file

@ -1,2 +1,3 @@
/target /target
*.tar.zst
**/*.rs.bk **/*.rs.bk

451
Cargo.lock generated
View file

@ -1,188 +1,467 @@
# This file is automatically @generated by Cargo. # This file is automatically @generated by Cargo.
# It is not intended for manual editing. # It is not intended for manual editing.
[[package]] version = 3
name = "ansi_term"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]] [[package]]
name = "atty" name = "autocfg"
version = "0.2.14" version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
"hermit-abi 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]] [[package]]
name = "bitflags" name = "bitflags"
version = "1.2.1" version = "1.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
name = "cc"
version = "1.0.79"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f"
[[package]]
name = "cfg-if"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]] [[package]]
name = "clap" name = "clap"
version = "2.33.0" version = "4.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c3d7ae14b20b94cb02149ed21a86c423859cbe18dc7ed69845cace50e52b40a5"
dependencies = [ dependencies = [
"ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "bitflags",
"atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", "clap_lex",
"bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "is-terminal",
"strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "strsim",
"textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "termcolor",
"unicode-width 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
"vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
name = "hermit-abi" name = "clap_lex"
version = "0.1.6" version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "350b9cf31731f9957399229e9b2adc51eeabdfbe9d71d9a0552275fd12710d09"
dependencies = [ dependencies = [
"libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)", "os_str_bytes",
]
[[package]]
name = "dirs"
version = "4.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ca3aa72a6f96ea37bbc5aa912f6788242832f75369bdfdadcb0e38423f100059"
dependencies = [
"dirs-sys",
]
[[package]]
name = "dirs-sys"
version = "0.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6"
dependencies = [
"libc",
"redox_users",
"winapi",
]
[[package]]
name = "errno"
version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1"
dependencies = [
"errno-dragonfly",
"libc",
"winapi",
]
[[package]]
name = "errno-dragonfly"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf"
dependencies = [
"cc",
"libc",
]
[[package]]
name = "getrandom"
version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31"
dependencies = [
"cfg-if",
"libc",
"wasi",
]
[[package]]
name = "hashbrown"
version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
[[package]]
name = "hermit-abi"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286"
[[package]]
name = "indexmap"
version = "1.9.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399"
dependencies = [
"autocfg",
"hashbrown",
]
[[package]]
name = "io-lifetimes"
version = "1.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1abeb7a0dd0f8181267ff8adc397075586500b81b28a73e8a0208b00fc170fb3"
dependencies = [
"libc",
"windows-sys",
]
[[package]]
name = "is-terminal"
version = "0.4.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "21b6b32576413a8e69b90e952e4a026476040d81017b80445deda5f2d3921857"
dependencies = [
"hermit-abi",
"io-lifetimes",
"rustix",
"windows-sys",
] ]
[[package]] [[package]]
name = "libc" name = "libc"
version = "0.2.66" version = "0.2.139"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79"
[[package]]
name = "linux-raw-sys"
version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4"
[[package]] [[package]]
name = "lqsd" name = "lqsd"
version = "0.1.0" version = "0.1.1"
dependencies = [ dependencies = [
"clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)", "clap",
"serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", "serde",
"toml 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", "toml",
"xdg 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "xdg",
] ]
[[package]] [[package]]
name = "proc-macro2" name = "memchr"
version = "1.0.8" version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d"
[[package]]
name = "os_str_bytes"
version = "6.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b7820b9daea5457c9f21c69448905d723fbd21136ccf521748f23fd49e723ee"
[[package]]
name = "proc-macro2"
version = "1.0.51"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5d727cae5b39d21da60fa540906919ad737832fe0b1c165da3a34d6548c849d6"
dependencies = [ dependencies = [
"unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-ident",
] ]
[[package]] [[package]]
name = "quote" name = "quote"
version = "1.0.2" version = "1.0.23"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b"
dependencies = [ dependencies = [
"proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2",
]
[[package]]
name = "redox_syscall"
version = "0.2.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a"
dependencies = [
"bitflags",
]
[[package]]
name = "redox_users"
version = "0.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b"
dependencies = [
"getrandom",
"redox_syscall",
"thiserror",
]
[[package]]
name = "rustix"
version = "0.36.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f43abb88211988493c1abb44a70efa56ff0ce98f233b7b276146f1f3f7ba9644"
dependencies = [
"bitflags",
"errno",
"io-lifetimes",
"libc",
"linux-raw-sys",
"windows-sys",
] ]
[[package]] [[package]]
name = "serde" name = "serde"
version = "1.0.104" version = "1.0.152"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bb7d1f0d3021d347a83e556fc4683dea2ea09d87bccdf88ff5c12545d89d5efb"
dependencies = [ dependencies = [
"serde_derive 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive",
] ]
[[package]] [[package]]
name = "serde_derive" name = "serde_derive"
version = "1.0.104" version = "1.0.152"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "af487d118eecd09402d70a5d72551860e788df87b464af30e5ea6a38c75c541e"
dependencies = [ dependencies = [
"proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2",
"quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "quote",
"syn 1.0.13 (registry+https://github.com/rust-lang/crates.io-index)", "syn",
]
[[package]]
name = "serde_spanned"
version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0efd8caf556a6cebd3b285caf480045fcc1ac04f6bd786b09a6f11af30c4fcf4"
dependencies = [
"serde",
] ]
[[package]] [[package]]
name = "strsim" name = "strsim"
version = "0.8.0" version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
[[package]] [[package]]
name = "syn" name = "syn"
version = "1.0.13" version = "1.0.109"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"
dependencies = [ dependencies = [
"proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2",
"quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "quote",
"unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-ident",
] ]
[[package]] [[package]]
name = "textwrap" name = "termcolor"
version = "0.11.0" version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6"
dependencies = [ dependencies = [
"unicode-width 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", "winapi-util",
]
[[package]]
name = "thiserror"
version = "1.0.38"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a9cd18aa97d5c45c6603caea1da6628790b37f7a34b6ca89522331c5180fed0"
dependencies = [
"thiserror-impl",
]
[[package]]
name = "thiserror-impl"
version = "1.0.38"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1fb327af4685e4d03fa8cbcf1716380da910eeb2bb8be417e7f9fd3fb164f36f"
dependencies = [
"proc-macro2",
"quote",
"syn",
] ]
[[package]] [[package]]
name = "toml" name = "toml"
version = "0.5.6" version = "0.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f7afcae9e3f0fe2c370fd4657108972cbb2fa9db1b9f84849cefd80741b01cb6"
dependencies = [ dependencies = [
"serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)", "serde",
"serde_spanned",
"toml_datetime",
"toml_edit",
] ]
[[package]] [[package]]
name = "unicode-width" name = "toml_datetime"
version = "0.1.7" version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3ab8ed2edee10b50132aed5f331333428b011c99402b5a534154ed15746f9622"
dependencies = [
"serde",
]
[[package]] [[package]]
name = "unicode-xid" name = "toml_edit"
version = "0.2.0" version = "0.19.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a1eb0622d28f4b9c90adc4ea4b2b46b47663fde9ac5fafcb14a1369d5508825"
dependencies = [
"indexmap",
"serde",
"serde_spanned",
"toml_datetime",
"winnow",
]
[[package]] [[package]]
name = "vec_map" name = "unicode-ident"
version = "0.8.1" version = "1.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc"
[[package]]
name = "wasi"
version = "0.11.0+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
[[package]] [[package]]
name = "winapi" name = "winapi"
version = "0.3.8" version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
dependencies = [ dependencies = [
"winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "winapi-i686-pc-windows-gnu",
"winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "winapi-x86_64-pc-windows-gnu",
] ]
[[package]] [[package]]
name = "winapi-i686-pc-windows-gnu" name = "winapi-i686-pc-windows-gnu"
version = "0.4.0" version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
[[package]]
name = "winapi-util"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178"
dependencies = [
"winapi",
]
[[package]] [[package]]
name = "winapi-x86_64-pc-windows-gnu" name = "winapi-x86_64-pc-windows-gnu"
version = "0.4.0" version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]]
name = "windows-sys"
version = "0.45.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0"
dependencies = [
"windows-targets",
]
[[package]]
name = "windows-targets"
version = "0.42.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e2522491fbfcd58cc84d47aeb2958948c4b8982e9a2d8a2a35bbaed431390e7"
dependencies = [
"windows_aarch64_gnullvm",
"windows_aarch64_msvc",
"windows_i686_gnu",
"windows_i686_msvc",
"windows_x86_64_gnu",
"windows_x86_64_gnullvm",
"windows_x86_64_msvc",
]
[[package]]
name = "windows_aarch64_gnullvm"
version = "0.42.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8c9864e83243fdec7fc9c5444389dcbbfd258f745e7853198f365e3c4968a608"
[[package]]
name = "windows_aarch64_msvc"
version = "0.42.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4c8b1b673ffc16c47a9ff48570a9d85e25d265735c503681332589af6253c6c7"
[[package]]
name = "windows_i686_gnu"
version = "0.42.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "de3887528ad530ba7bdbb1faa8275ec7a1155a45ffa57c37993960277145d640"
[[package]]
name = "windows_i686_msvc"
version = "0.42.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bf4d1122317eddd6ff351aa852118a2418ad4214e6613a50e0191f7004372605"
[[package]]
name = "windows_x86_64_gnu"
version = "0.42.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c1040f221285e17ebccbc2591ffdc2d44ee1f9186324dd3e84e99ac68d699c45"
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.42.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "628bfdf232daa22b0d64fdb62b09fcc36bb01f05a3939e20ab73aaf9470d0463"
[[package]]
name = "windows_x86_64_msvc"
version = "0.42.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd"
[[package]]
name = "winnow"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "faf09497b8f8b5ac5d3bb4d05c0a99be20f26fd3d5f2db7b0716e946d5103658"
dependencies = [
"memchr",
]
[[package]] [[package]]
name = "xdg" name = "xdg"
version = "2.2.0" version = "2.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0c4583db5cbd4c4c0303df2d15af80f0539db703fa1c68802d4cbbd2dd0f88f6"
[metadata] dependencies = [
"checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" "dirs",
"checksum atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" ]
"checksum bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
"checksum clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5067f5bb2d80ef5d68b4c87db81601f0b75bca627bc2ef76b141d7b846a3c6d9"
"checksum hermit-abi 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "eff2656d88f158ce120947499e971d743c05dbcbed62e5bd2f38f1698bbc3772"
"checksum libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)" = "d515b1f41455adea1313a4a2ac8a8a477634fbae63cc6100e3aebb207ce61558"
"checksum proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)" = "3acb317c6ff86a4e579dfa00fc5e6cca91ecbb4e7eb2df0468805b674eb88548"
"checksum quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe"
"checksum serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)" = "414115f25f818d7dfccec8ee535d76949ae78584fc4f79a6f45a904bf8ab4449"
"checksum serde_derive 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)" = "128f9e303a5a29922045a830221b8f78ec74a5f544944f3d5984f8ec3895ef64"
"checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
"checksum syn 1.0.13 (registry+https://github.com/rust-lang/crates.io-index)" = "1e4ff033220a41d1a57d8125eab57bf5263783dfdcc18688b1dacc6ce9651ef8"
"checksum textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060"
"checksum toml 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "ffc92d160b1eef40665be3a05630d003936a3bc7da7421277846c2613e92c71a"
"checksum unicode-width 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "caaa9d531767d1ff2150b9332433f32a24622147e5ebb1f26409d5da67afd479"
"checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c"
"checksum vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a"
"checksum winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "8093091eeb260906a183e6ae1abdba2ef5ef2257a21801128899c3fc699229c6"
"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
"checksum xdg 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d089681aa106a86fade1b0128fb5daf07d5867a509ab036d99988dec80429a57"

View file

@ -1,15 +1,15 @@
[package] [package]
name = "lqsd" name = "lqsd"
version = "0.1.0" version = "0.1.1"
authors = ["Marko Korhonen <marko.korhonen@reekynet.com>"] authors = ["Marko Korhonen <lqsd@functionalhacker.korhonen.cc>"]
edition = "2018" edition = "2018"
publish = false publish = false
description = "Dims your screen smoothly" description = "Dims your screen smoothly"
repository = "https://git.reekynet.com/ReekyMarko/lqsd" repository = "https://git.korhonen.cc/FunctionalHacker/lqsd"
license = "MIT" license = "MIT"
[dependencies] [dependencies]
clap = "2.33.0" clap = { version = "4.1.8" }
serde = {version = "1.0.104", features = ["derive"]} serde = { version = "1.0.152", features = ["derive"] }
toml = "0.5.6" toml = "0.7.2"
xdg = "2.2.0" xdg = "2.4.1"

View file

108
README.adoc Normal file
View file

@ -0,0 +1,108 @@
= LiQuid Screen Dim
A simple utility which dims your screen. It saves the previous
brightness too, so you can restore to the point before dimming.
This is useful if you are running a standalone screen locking setup like
swayidle/swaylock. Check out
https://git.korhonen.cc/FunctionalHacker/dotfiles/src/branch/main/home/.config/sway/scripts/idle.sh[my
configuration files] for an example use case.
== Usage
[source]
----
USAGE:
lqsd [FLAGS] [OPTIONS]
FLAGS:
-d, --dim Dims the screen to idle level set in configuration
-r, --resume Sets the backlight to the value it was before dimming
--copy-config Copies the default config file to $XDG_CONFIG_HOME/lqsd
-h, --help Prints help information
-V, --version Prints version information
OPTIONS:
--config <FILE> Sets a custom config file
----
The configuration file resides at `~/.config/lqsd/config.toml`. To copy
the default configuration file in place, you can use `--copy-config`.
In the configuration file you can set the following values:
[width="100%",cols="1,2,1",options="header"]
|===
|Key|Explanation|Default
|resume_file
|The location where the previous brightness is saved
|/tmp/lqsd-resume
|idle_level
|The minimum brightness that will be dimmed to. Can be a value between 0-100
|0
|dim_speed
|This sets the "sleep time" between each backlight command. Its in milliseconds
|50
|resume_speed
|Same as dim_speed, but for the resume operation `-r`
|25
|===
== Installation
=== Dependencies
The only external dependency is
https://github.com/haikarainen/light[light].
=== Building
Clone this repository and run `cargo build --release` inside the project
to compile a static binary.
=== Arch Linux
So far, I have only packaged this for Arch Linux. Packages are in
https://aur.archlinux.org/packages/?K=lqsd[AUR].
To install it, use your favorite AUR helper, yay for example:
[source,nosyntax]
----
yay -S lqsd
----
Select if you want to [1] build from source [2] install a precompiled
binary:
[source,nosyntax]
----
:: There are 2 providers available for lqsd:
:: Repository AUR
1) lqsd 2) lqsd-bin
Enter a number (default=1):
----
== Releases
Release notes and binaries can be found either in
https://git.korhonen.cc/FunctionalHacker/lqsd/releases[My Git server] or
https://github.com/FunctionalHacker/lqsd/releases[GitHub].
== Why Rust?
I wanted start a small project to learn Rust. Before lqsd, I was using
https://github.com/Bonnee/dotfiles/blob/wayland/scripts/bin/dim.sh[this
script] and figured, why not rewrite it in Rust.
== Mirrors
This repository lives at
https://git.korhonen.cc/FunctionalHacker/lqsd[My Git server], but it is
also mirrored to https://github.com/FunctionalHacker/lqsd[GitHub] and
https://gitlab.com/FunctionalHacker/lqsd[GitLab]

View file

@ -1,46 +0,0 @@
# LiQuid Screen Dim
A simple utility which dims your screen. It saves the previous brightness too, so you can restore to the point before dimming.
This is useful if you are running a standalone screen locking setup like swayidle/swaylock. Check out [my configuration files](https://git.reekynet.com/ReekyMarko/dotfiles/src/branch/master/home/Scripts/swayidle.sh) for an example use case.
## Usage
```nosyntax
USAGE:
lqsd [FLAGS] [OPTIONS]
FLAGS:
-d, --dim Dims the screen to idle level set in configuration
-h, --help Prints help information
-r, --resume Sets the backlight to the value it was before dimming
-V, --version Prints version information
OPTIONS:
-c, --config <config> Sets a custom config file
```
The configuration file resides at `~/.config/lqsd/config.toml`. There you can set these values:
| Key | Explanation | Default |
| ---------------- | -------------------------------------------------------------------------------------------- | :-----------------: |
| resume_file | The location where the previous brightness is saved | "/tmp/lqsd-resume" |
| idle_level | The minimum brightness that will be dimmed to. Can be a value between 0-100 | 0 |
| dim_speed | This sets the "sleep time" between each backlight command. It's in milliseconds | 50 |
| resume_speed | Same as dim_speed, only for the resume operation `-r` | 25 |
## Installation
So far, I have only packaged this for [Arch Linux](https://aur.archlinux.org/packages/lqsd)
To install it, use your favorite AUR helper, yay for example:
```nosyntax
yay -S lqsd
```
Or if you don't want to build it from source, a binary version is also available:
```nosyntax
yay -S lqsd-bin
```
## Why Rust?
I wanted start a small project to learn Rust. Before lqsd, I was using [this script](https://github.com/Bonnee/dotfiles/blob/wayland/scripts/bin/dim.sh) and figured, why not rewrite it in Rust.
# Mirrors
This repository lives at [ReekyNET Git](https://git.reekynet.com/ReekyMarko/lqsd), but it is also mirrored to [GitLab](https://gitlab.com/ReekyMarko/lqsd) and [GitHub](https://github.com/ReekyMarko/lqsd)

65
build-release.sh Executable file
View file

@ -0,0 +1,65 @@
#!/bin/sh
if [ $# = 1 ]; then
TAG=$1
else
TAG=$(git tag | tail -1)
fi
VERSION_NR=$(echo "$TAG" | cut -c2-)
printf "\e[34m Building release version %s\e[0m\n\n" "$VERSION_NR"
printf "\e[34m Checking out %s \e[0m\n\n" "$TAG"
git checkout "tags/$TAG" > /dev/null 2>&1
printf "\e[34m Building with cargo\e[0m\n"
cargo build --release --locked
printf "\n\n"
printf "\e[34m Copying needed files for release\e[0m\n\n"
mkdir release
cp target/release/lqsd release/
cp LICENSE release/
cp manpage.adoc release/
cd release || return
printf "\e[34m Signing binary with GPG\e[0m\n"
gpg --detach-sign --armor lqsd
printf "\n"
printf "\e[34m Calculating checksums\e[0m\n\n"
sha256sum lqsd > lqsd.sha256
md5sum lqsd > lqsd.md5
printf "\e[34m Verifying GPG signature\e[0m\n"
gpg --verify lqsd.asc
printf "\n\n"
printf "\e[34m Validating checksums\e[0m\n"
sha256sum -c lqsd.sha256
md5sum -c lqsd.md5
printf "\n\n"
printf "\e[34m Building documentation\e[0m\n"
asciidoctor -b manpage manpage.adoc
printf "\n\n"
printf "\e[34m Compressing to tar.zst\e[0m\n\n"
tar cf lqsd_"${VERSION_NR}"_x86_64.tar.zst ./* --zstd
mv ./*.tar.zst ..
cd ..
printf "\e[34m removing leftover files\e[0m\n\n"
rm -r release
printf "\e[34m Returning to main\e[0m\n\n"
git checkout main > /dev/null 2>&1

31
manpage.adoc Normal file
View file

@ -0,0 +1,31 @@
= lqsd(1)
Marko Korhonen
v0.1.1
:doctype: manpage
:manmanual: LQSD
:mansource: LQSD
:man-linkstyle: pass:[blue R < >]
== Name
lqsd - dim your screen smoothly
== Synopsis
*lqsd* [_OPTION_]
== Options
*-d, --dim*::
Dims the screen to idle level set in configuration
*-r, --resume*::
Sets the backlight to the value it was before dimming
*--copy-config*::
Copies the default config file to $XDG_CONFIG_HOME/lqsd
*-h, --help*::
Prints help information
*-V, --version*::
Prints version information
== Resources
*Project source code:* https://git.korhonen.cc/FunctionalHacker/lqsd

View file

@ -1,32 +1,47 @@
extern crate clap; extern crate clap;
use clap::{App, AppSettings, Arg}; use clap::{Command, Arg, ArgAction};
pub fn get_args() -> clap::ArgMatches<'static> { pub fn app() -> Command {
App::new("LiQuid Screen Dim") Command::new("LiQuid Screen Dim")
.version(env!("CARGO_PKG_VERSION")) .version(env!("CARGO_PKG_VERSION"))
.author(env!("CARGO_PKG_AUTHORS")) .author(env!("CARGO_PKG_AUTHORS"))
.about(env!("CARGO_PKG_DESCRIPTION")) .about(env!("CARGO_PKG_DESCRIPTION"))
.setting(AppSettings::ArgRequiredElseHelp) .arg_required_else_help(true)
.arg( .arg(
Arg::with_name("dim") Arg::new("dim")
.long("dim") .long("dim")
.short("d") .short('d')
.takes_value(false) .action(ArgAction::SetTrue)
.display_order(1)
.help("Dims the screen to idle level set in configuration"), .help("Dims the screen to idle level set in configuration"),
) )
.arg( .arg(
Arg::with_name("resume") Arg::new("resume")
.long("resume") .long("resume")
.short("r") .short('r')
.takes_value(false) .action(ArgAction::SetTrue)
.display_order(2)
.help("Sets the backlight to the value it was before dimming"), .help("Sets the backlight to the value it was before dimming"),
) )
.arg( .arg(
Arg::with_name("config") Arg::new("copy-config")
.long("copy-config")
.action(ArgAction::SetTrue)
.display_order(3)
.help("Copies the default config file to $XDG_CONFIG_HOME/lqsd"),
)
.arg(
Arg::new("config")
.short('c')
.long("config") .long("config")
.short("c") .num_args(1)
.takes_value(true) .number_of_values(1)
.value_name("FILE")
.help("Sets a custom config file"), .help("Sets a custom config file"),
) )
.get_matches() }
#[test]
fn verify_app() {
app().debug_assert();
} }

View file

@ -1,52 +1,84 @@
extern crate xdg;
use super::fs; use super::fs;
use super::Config; use serde::{Deserialize, Serialize};
use std::path::PathBuf; use std::path::PathBuf;
use xdg::BaseDirectories; use xdg::BaseDirectories;
extern crate xdg; #[derive(Deserialize, Serialize)]
#[serde(default)]
pub struct Config {
pub resume_file: PathBuf,
pub idle_level: i32,
pub dim_speed: u64,
pub resume_speed: u64,
}
fn default_config() -> Config { impl Default for Config {
Config { fn default() -> Self {
Self {
resume_file: PathBuf::from("/tmp/lqsd-resume"), resume_file: PathBuf::from("/tmp/lqsd-resume"),
idle_level: 0, idle_level: 0,
dim_speed: 50, dim_speed: 50,
resume_speed: 25, resume_speed: 25,
} }
} }
}
fn xdg_config() -> PathBuf { fn read_parse(path: PathBuf) -> Config {
let mut _toml = String::from("");
match fs::read(&path) {
Ok(result) => _toml = result,
Err(err) => {
eprintln!("Failed to read config: {}", err);
println!("Using default config");
return Config::default();
}
}
match toml::from_str(&_toml) {
Ok(result) => return result,
Err(err) => {
eprintln!("Failed to read config: {}", err);
println!("Using default config");
return Config::default();
}
}
}
fn xdg_path() -> PathBuf {
BaseDirectories::with_prefix("lqsd") BaseDirectories::with_prefix("lqsd")
.expect("cannot create configuration directory") .expect("cannot create configuration directory")
.place_config_file("config.toml") .place_config_file("config.toml")
.unwrap() .unwrap()
} }
pub fn load_xdg() -> Config { pub fn copy_config() {
let path = xdg_config(); let path = xdg_path();
if !path.exists() { if !path.exists() {
println!( match fs::write(&path, toml::to_string(&Config::default()).unwrap()) {
"{} does not exist, writing default configuration",
path.display()
);
match fs::write(&path, toml::to_string(&default_config()).unwrap()) {
Ok(()) => println!("Default config saved to {}", path.display()), Ok(()) => println!("Default config saved to {}", path.display()),
Err(err) => eprintln!("Failed to write default config: {}", err), Err(err) => eprintln!("Failed to write default config: {}", err),
}; };
default_config()
} else { } else {
let toml = fs::read(&path).unwrap(); eprintln!(
let config: Config = toml::from_str(&toml).unwrap(); "There is a file at {} already. Will not overwrite",
config path.display()
);
}
}
pub fn load_xdg() -> Config {
let path = xdg_path();
if !path.exists() {
Config::default()
} else {
read_parse(xdg_path())
} }
} }
pub fn load_user(path: PathBuf) -> Config { pub fn load_user(path: PathBuf) -> Config {
if !path.exists() { read_parse(path)
panic!("{} does not exist", path.display());
} else {
let toml = fs::read(&path).unwrap();
let config: Config = toml::from_str(&toml).unwrap();
config
}
} }

View file

@ -1,21 +1,13 @@
extern crate clap; extern crate clap;
mod cli; use config::Config;
mod config;
mod fs;
use serde::{Deserialize, Serialize};
use std::path::PathBuf; use std::path::PathBuf;
use std::process::Command; use std::process::Command;
use std::{thread, time}; use std::{thread, time};
#[derive(Deserialize, Serialize)] mod cli;
pub struct Config { mod config;
resume_file: PathBuf, mod fs;
idle_level: i32,
dim_speed: u64,
resume_speed: u64,
}
fn transition(w_brightness: i32, speed: time::Duration) { fn transition(w_brightness: i32, speed: time::Duration) {
let c_brightness = get_brightness(); let c_brightness = get_brightness();
@ -57,32 +49,51 @@ fn get_brightness() -> i32 {
} }
fn main() { fn main() {
let args = cli::get_args(); let args = cli::app().get_matches();
let conf: Config; let conf: Config;
if args.is_present("config") { if let Some(config_path) = args.get_one::<String>("config") {
let config_path = PathBuf::from(args.value_of("config").unwrap()); let config_path_buf = PathBuf::from(config_path);
conf = config::load_user(config_path); conf = config::load_user(config_path_buf);
} else { } else {
conf = config::load_xdg(); conf = config::load_xdg();
} }
let dim_speed = time::Duration::from_millis(conf.dim_speed); let dim_speed = time::Duration::from_millis(conf.dim_speed);
let resume_speed = time::Duration::from_millis(conf.resume_speed); let resume_speed = time::Duration::from_millis(conf.resume_speed);
if args.is_present("dim") { if args.get_flag("dim") {
let current_brightness = get_brightness().to_string(); let current_brightness = get_brightness().to_string();
match fs::write(&conf.resume_file, current_brightness) { match fs::write(&conf.resume_file, current_brightness) {
Ok(()) => println!("Current brightness written to resume file"), Ok(()) => println!(
"Current brightness written to resume file at {}",
conf.resume_file.display()
),
Err(err) => eprintln!("Error writing brightness to resume file: {}", err), Err(err) => eprintln!("Error writing brightness to resume file: {}", err),
} }
transition(conf.idle_level, dim_speed); transition(conf.idle_level, dim_speed);
} }
if args.is_present("resume") {
let old_brightness: i32 = fs::read(&conf.resume_file).unwrap().parse().unwrap(); if args.get_flag("resume") {
let old_brightness: i32;
match fs::read(&conf.resume_file) {
Ok(result) => old_brightness = result.parse().unwrap(),
Err(err) => {
eprintln!("Failed to read resume_file: {}", err);
old_brightness = 100;
}
}
transition(old_brightness, resume_speed); transition(old_brightness, resume_speed);
match fs::remove(&conf.resume_file) { match fs::remove(&conf.resume_file) {
Ok(()) => println!("Resume file removed"), Ok(()) => println!("Resume file removed"),
Err(err) => eprintln!("Failed to remove resume file: {}", err), Err(err) => eprintln!("Failed to remove resume file: {}", err),
} }
} }
if args.get_flag("copy-config") {
config::copy_config();
}
} }