Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configfile #47

Merged
merged 28 commits into from
Feb 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
618f1cd
config: Initial support for config file
vincentdephily Jan 9, 2024
37da686
conf: Add `starttime` config item, introduce `ArgParse` trait
vincentdephily Jan 12, 2024
06665ea
conf: Add `average` config item
vincentdephily Jan 14, 2024
9586782
conf: Refactor
vincentdephily Jan 15, 2024
3824cf1
conf: Merge `Styles` struct into `Conf`
vincentdephily Jan 15, 2024
15d2de4
conf: Move `Toml` to its own module
vincentdephily Jan 15, 2024
04acbfe
qa: Clippy
vincentdephily Jan 25, 2024
76896e4
conf: Move code to a types submodule, make `ArgParse` and `sel()` mor…
vincentdephily Jan 24, 2024
8c397ea
conf: Make `show` arg configurable
vincentdephily Jan 26, 2024
084741a
conf: Refactor conf var names
vincentdephily Jan 26, 2024
cfe7c23
conf: Use a `sel!()` macro to simplify code
vincentdephily Jan 27, 2024
ad059ec
conf: Make logfile configurable
vincentdephily Jan 27, 2024
4646d9d
conf: Move `--from/--to` to `Conf`, use our own error type instead of…
vincentdephily Jan 30, 2024
f1d4c1f
conf: move `search`/`exact` to `Conf`
vincentdephily Jan 30, 2024
54868ef
conf: Move `--first`/`--last` to `Conf`
vincentdephily Jan 31, 2024
3c84f71
conf: Move `--limit` to `Conf`, make it configurable
vincentdephily Feb 3, 2024
44fe50a
conf: Move `--group` to `Conf`, make configurable
vincentdephily Feb 4, 2024
ecb1e2d
conf: Move `--resume` to `Conf`
vincentdephily Feb 4, 2024
7aabeb5
conf: Move `--unknown` to `Conf`, make configurable
vincentdephily Feb 5, 2024
f4fbf02
conf: Move `--tmpdir` to `Conf`, make configurable
vincentdephily Feb 6, 2024
9a40964
qa: s/args/cli/
vincentdephily Feb 6, 2024
1795bad
conf: move `--shell` to `Conf`
vincentdephily Feb 6, 2024
35cad99
qa: Move cli.rs to config/
vincentdephily Feb 6, 2024
e701e9c
conf: Make `header`,`utc` and `duration` configurable
vincentdephily Feb 6, 2024
a1594ab
conf: Remove the `--config` cli flag
vincentdephily Feb 6, 2024
a5b1d3a
doc: Update changelog, example config, inline help
vincentdephily Feb 6, 2024
6a55387
qa: Clippy fix
vincentdephily Feb 7, 2024
4880142
conf: Only print a warning for unreadable config file
vincentdephily Feb 7, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

* Support searching by multiple terms
- eg `emlop s -e gcc clang llvm rust`
* Support configuration file
- Located by default in `~/.config/emlop.toml`, overridable with `$EMLOP_CONFIG` env var
- Example config added to repo, should be installed alongside emlop docs
- Config options, when available, always correspond to a cli arg
- Many flags/args now take an optional `no` value, so the cli can override the conf
* Improve predict:
- Autodetect `tmpdir` using currently running emerge processes
- Support multiple `--tmpdir` arguments
Expand Down
75 changes: 75 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ edition = "2021"
rust-version = "1.70.0"
exclude = ["benches", "docs", "rustfmt.toml", ".github", ".gitignore"]

[lints.clippy]
missing_const_for_fn = "warn"

[dependencies]
anyhow = "1.0.32"
atoi = "2.0.0"
Expand All @@ -30,6 +33,7 @@ rev_lines = "0.3.0"
serde = { version = "1.0.184", features = ["derive"] }
serde_json = "1.0.89"
time = {version = "~0.3.18", features = ["parsing", "formatting", "local-offset", "macros"]}
toml = "0.8.8"

[dev-dependencies]
assert_cmd = "~2.0.0"
Expand Down
30 changes: 30 additions & 0 deletions emlop.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# This is an example `emlop` config file.
#
# It is loaded from `$HOME/.config/emlop.toml` by default.
# Use `$EMLOP_CONFIG` to set a different location, empty string to disable config loading.
# Entries have the same name and format as command-line args, see `emlop <command> --help`.
# Some args are only avaible via the command line.

# logfile = "/var/log/emerge.log"
# date = "rfc2822"
# duration = "human"
# utc = true
# header = true
[log]
# show = "mus"
# starttime = true
[predict]
# show = "emt"
# avg = "arith"
# limit = 20
# unknown = 300
# tmpdir = ["/foo", "/bar"]
[stats]
# show = "pts"
# avg = "arith"
# limit = 20
# group = "y"
[accuracy]
# show = "mt"
# avg = "arith"
# limit = 20
Loading