Skip to content

Commit 00ec04f

Browse files
committed
v0.5.0: bump version and update docs
This commit also sneaks in a few doc tests to catch documentation issues a bit faster.
1 parent 6f632f9 commit 00ec04f

File tree

7 files changed

+113
-73
lines changed

7 files changed

+113
-73
lines changed

demo.tape

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ Set FontSize 16
7474
Set Width 1280
7575
Set Height 720
7676

77-
Type@10ms "systemctl start --user '0-isd-example-unit-01.service' '0-isd-example-unit-03.service'" Enter
77+
# Should first run `./result/bin/generate-doc-test-data`.
78+
Type@10ms "systemctl start --user '0-isd-example-unit-01.service' '0-isd-example-unit-05.service'" Enter
7879
# do not full refresh during recording -> Set it to a very large value
7980
# normal refresh should use the default value!
8081
Type@10ms "ISD_CACHE_INPUT=false ISD_STARTUP_MODE=user ISD_JOURNAL_PAGER=lnav ISD_DEFAULT_PAGER=moar ISD_PREVIEW_AND_SELECTION_REFRESH_INTERVAL_SEC=2.5 ISD_FULL_REFRESH_INTERVAL_SEC=1000 asciinema rec --overwrite --quiet --command isd ./docs/assets/images/isd.cast"
@@ -92,7 +93,7 @@ Type "0-isd exmpl u 0"
9293
Sleep 2s Type "]"
9394

9495
Tab
95-
Sleep 2s Space Down Down
96+
Sleep 2s Space Down@750ms 4
9697
# Multi-selection marker
9798
Sleep 1s Type "]" Sleep 1s
9899

@@ -123,7 +124,7 @@ Type "q"
123124
Sleep 2s
124125

125126
# show journal preview marker
126-
Tab Sleep 0.5s Right
127+
Tab Sleep 0.5s Tab Sleep 0.5s Right
127128
Sleep 3s Type "]"
128129
Sleep 1s Ctrl+p Type "open pag" Sleep 1.5s
129130
Enter

docs/customization.md

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ Just jump to the sections that sound interesting:
5858
- [Journal Pager](#journal-pager)
5959
- [Journal Pager Arguments](#journal-pager-arguments)
6060
- [Theme](#theme)
61+
- [Layout](#layout)
6162
- [Keybindings](#keybindings)
6263
- [Generic Keybindings](#generic-keybindings)
6364
- [Main Keybindings](#main-keybindings)
@@ -179,6 +180,18 @@ But to persist the changes you _must_ update the configuration file.
179180
<!-- [ansi escape codes](https://github.com/tinted-theming/home) -->
180181
<!-- you -->
181182

183+
### Layout
184+
185+
`isd` allows you to customize the layout.
186+
Currently, the relative heights between the search results and preview widgets
187+
can be adjusted:
188+
189+
{{ config_block(11) }}
190+
191+
{{ config_block(12) }}
192+
193+
By default the preview widget is about twice as tall as the search results widget.
194+
182195
### Keybindings
183196

184197
> With great flexibility comes great responsibility.
@@ -208,25 +221,25 @@ for keybindings:
208221

209222
#### Generic Keybindings
210223

211-
{{ config_block(11) }}
224+
{{ config_block(13) }}
212225

213226
See [Keybindings](#keybindings) for more general information.
214227

215228
#### Main Keybindings
216229

217-
{{ config_block(12) }}
230+
{{ config_block(14) }}
218231

219232
See [Keybindings](#keybindings) for more general information.
220233

221234
#### Navigation Keybindings
222235

223-
{{ config_block(13) }}
236+
{{ config_block(15) }}
224237

225238
See [Keybindings](#keybindings) for more general information.
226239

227240
#### `systemctl` Keybindings
228241

229-
{{ config_block(14) }}
242+
{{ config_block(16) }}
230243

231244
This allows you to configure the `systemctl` commands and keybindings.
232245
It is important to note that the `command` key may contain spaces (like `edit --runtime`)
@@ -250,21 +263,21 @@ the [shell injection section](security.md/#shell-injection).
250263

251264
### Pager Arguments
252265

253-
{{ config_block(15) }}
266+
{{ config_block(17) }}
254267

255268
If you have to customize the pager arguments for a common pager,
256269
please open an issue!
257270

258271
### Journal Pager Arguments
259272

260-
{{ config_block(16) }}
273+
{{ config_block(18) }}
261274

262275
If you have to customize the pager arguments for a common pager,
263276
please open an issue!
264277

265278
### Maximum Preview Lines
266279

267-
{{ config_block(17) }}
280+
{{ config_block(19) }}
268281

269282
This value can mainly be configured if opening the journal preview
270283
window takes too long. Though, it should usually not be required

docs/faq.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ Limiting the functionality of the preview window is an explicit design decision
6060
`isd` should be seen as the gateway to interact and work with `systemd` units while
6161
seamlessly integrating with other, purpose-built tools.
6262
By integrating with other tools, `isd` limits the scope of the application
63-
(reducing feature creep) and gives users full control since it is easy to configure
63+
(reducing feature creep), and gives you, the user, full control since it is easy to configure
6464
your favorite pager/editor.
6565

6666
The main _goal_ of the preview window is to give quick feedback about the selected/highlighted

flake.nix

Lines changed: 71 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,40 @@
179179
pkgs = pkgsFor.${system};
180180
pythonSet = pythonSet313For.${system};
181181
version = (builtins.fromTOML (builtins.readFile ./pyproject.toml)).project.version;
182+
gen_unit =
183+
name:
184+
inputs.systemd-nix.lib.${system}.mkUserService name {
185+
description = name;
186+
documentation = [ "man:python" ];
187+
wants = [ "default.target" ];
188+
after = [ "default.target" ];
189+
serviceConfig = {
190+
Type = "simple"; # or oneshot for multiple ExecStart
191+
# ExecStart = "${lib.getExe' pkgs.coreutils "sleep"} 1m";
192+
ExecStart = "${lib.getExe pythonSet.python} ${./docs/loggen.py} 100";
193+
# --number <number-of-messages>
194+
# --interval <number of seconds loggen will run>
195+
# --rate message per second
196+
RemainAfterExit = true;
197+
};
198+
};
199+
gen_broken_unit =
200+
name:
201+
inputs.systemd-nix.lib.${system}.mkUserService name {
202+
description = name;
203+
documentation = [ "man:python" ];
204+
wants = [ "default.target" ];
205+
after = [ "default.target" ];
206+
serviceConfig = {
207+
Type = "simple"; # or oneshot for multiple ExecStart
208+
# ExecStart = "${lib.getExe' pkgs.coreutils "sleep"} 1m";
209+
ExecStart = "${lib.getExe pythonSet.python} -asdf";
210+
# --number <number-of-messages>
211+
# --interval <number of seconds loggen will run>
212+
# --rate message per second
213+
RemainAfterExit = true;
214+
};
215+
};
182216
in
183217
rec {
184218
default =
@@ -245,65 +279,45 @@
245279
};
246280
};
247281

248-
generate-integration-test-data =
249-
let
250-
gen_unit =
251-
name:
252-
inputs.systemd-nix.lib.${system}.mkUserService name {
253-
description = name;
254-
documentation = [ "man:python" ];
255-
wants = [ "default.target" ];
256-
after = [ "default.target" ];
257-
serviceConfig = {
258-
Type = "simple"; # or oneshot for multiple ExecStart
259-
# ExecStart = "${lib.getExe' pkgs.coreutils "sleep"} 1m";
260-
ExecStart = "${lib.getExe pythonSet.python} ${./docs/loggen.py} 100";
261-
# --number <number-of-messages>
262-
# --interval <number of seconds loggen will run>
263-
# --rate message per second
264-
RemainAfterExit = true;
265-
};
266-
};
267-
gen_broken_unit =
268-
name:
269-
inputs.systemd-nix.lib.${system}.mkUserService name {
270-
description = name;
271-
documentation = [ "man:python" ];
272-
wants = [ "default.target" ];
273-
after = [ "default.target" ];
274-
serviceConfig = {
275-
Type = "simple"; # or oneshot for multiple ExecStart
276-
# ExecStart = "${lib.getExe' pkgs.coreutils "sleep"} 1m";
277-
ExecStart = "${lib.getExe pythonSet.python} -asdf";
278-
# --number <number-of-messages>
279-
# --interval <number of seconds loggen will run>
280-
# --rate message per second
281-
RemainAfterExit = true;
282-
};
283-
};
284-
in
285-
pkgs.writeScriptBin "generate-integration-test-data" ''
286-
set -e
287-
${lib.getExe (gen_unit "0-isd-example-unit-01")}
288-
${lib.getExe (gen_unit "0-isd-example-unit-02")}
289-
${lib.getExe (gen_unit "0-isd-example-unit-03")}
290-
${lib.getExe (gen_broken_unit "0-isd-example-unit-04")}
282+
generate-integration-test-data = pkgs.writeScriptBin "generate-integration-test-data" ''
283+
set -e
284+
${lib.getExe (gen_unit "0-isd-example-unit-01")}
285+
${lib.getExe (gen_unit "0-isd-example-unit-02")}
286+
${lib.getExe (gen_unit "0-isd-example-unit-03")}
287+
${lib.getExe (gen_broken_unit "0-isd-example-unit-04")}
291288
292-
systemctl --user stop "0-isd-example-unit-02.service"
293-
systemctl --user stop "0-isd-example-unit-03.service"
294-
ln -s /tmp/__wrong_path_that_does_not_exist --force "$HOME/.config/systemd/user/0-isd-example-unit-03.service"
295-
# 4 is broken by default
296-
systemctl --user daemon-reload
289+
systemctl --user stop "0-isd-example-unit-02.service"
290+
systemctl --user stop "0-isd-example-unit-03.service"
291+
ln -s /tmp/__wrong_path_that_does_not_exist --force "$HOME/.config/systemd/user/0-isd-example-unit-03.service"
292+
# 4 is broken by default
293+
systemctl --user daemon-reload
297294
298-
# Now generate the sample data from the above generated state.
299-
export _SYSTEMD_USER_MODE=1
300-
export OUT_DIR="$(git rev-parse --show-toplevel)/tests/integration-test/"
301-
${lib.getExe pkgs.bash} ${./tests/test_data_generator.sh} generate_list_data "0-isd*"
302-
${lib.getExe pkgs.bash} ${./tests/test_data_generator.sh} generate_unit_data "0-isd-example-unit-01.service"
303-
${lib.getExe pkgs.bash} ${./tests/test_data_generator.sh} generate_unit_data "0-isd-example-unit-02.service"
304-
${lib.getExe pkgs.bash} ${./tests/test_data_generator.sh} generate_unit_data "0-isd-example-unit-03.service"
305-
${lib.getExe pkgs.bash} ${./tests/test_data_generator.sh} generate_unit_data "0-isd-example-unit-04.service"
306-
'';
295+
# Now generate the sample data from the above generated state.
296+
export _SYSTEMD_USER_MODE=1
297+
export OUT_DIR="$(git rev-parse --show-toplevel)/tests/integration-test/"
298+
${lib.getExe pkgs.bash} ${./tests/test_data_generator.sh} generate_list_data "0-isd*"
299+
${lib.getExe pkgs.bash} ${./tests/test_data_generator.sh} generate_unit_data "0-isd-example-unit-01.service"
300+
${lib.getExe pkgs.bash} ${./tests/test_data_generator.sh} generate_unit_data "0-isd-example-unit-02.service"
301+
${lib.getExe pkgs.bash} ${./tests/test_data_generator.sh} generate_unit_data "0-isd-example-unit-03.service"
302+
${lib.getExe pkgs.bash} ${./tests/test_data_generator.sh} generate_unit_data "0-isd-example-unit-04.service"
303+
'';
304+
305+
generate-doc-test-data = pkgs.writeScriptBin "generate-doc-test-data" ''
306+
set -e
307+
${lib.getExe (gen_unit "0-isd-example-unit-01")}
308+
${lib.getExe (gen_unit "0-isd-example-unit-02")}
309+
${lib.getExe (gen_unit "0-isd-example-unit-03")}
310+
${lib.getExe (gen_broken_unit "0-isd-example-unit-04")}
311+
${lib.getExe (gen_unit "0-isd-example-unit-05")}
312+
${lib.getExe (gen_unit "0-isd-example-unit-06")}
313+
${lib.getExe (gen_unit "0-isd-example-unit-07")}
314+
315+
systemctl --user stop "0-isd-example-unit-02.service"
316+
systemctl --user stop "0-isd-example-unit-03.service"
317+
ln -s /tmp/__wrong_path_that_does_not_exist --force "$HOME/.config/systemd/user/0-isd-example-unit-03.service"
318+
# 4 is broken by default
319+
systemctl --user daemon-reload
320+
'';
307321
}
308322
);
309323

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ dependencies = [
2727
"pydantic>=2.10.4",
2828
"types-pyyaml>=6.0.12.20241221",
2929
]
30-
version = "0.4.1"
30+
version = "0.5.0"
3131

3232
# # versioningit was great in theory
3333
# # but it comes with too many issues for packaging
@@ -97,7 +97,7 @@ exclude = [
9797
"share/" = "share/"
9898

9999
[tool.bumpversion]
100-
current_version = "0.4.1"
100+
current_version = "0.5.0"
101101
parse = """
102102
(?P<major>0|[1-9]\\d*)\\.
103103
(?P<minor>0|[1-9]\\d*)\\.

src/isd_tui/isd.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -766,8 +766,12 @@ class Settings(BaseSettings):
766766
default=Theme("textual-dark"), description="The theme of the application."
767767
)
768768

769-
search_results_height_fraction: PositiveInt = 1
770-
preview_height_fraction: PositiveInt = 2
769+
search_results_height_fraction: PositiveInt = Field(
770+
default=1, description="Relative height compared to preview height."
771+
)
772+
preview_height_fraction: PositiveInt = Field(
773+
default=2, description="Relative height compared to search result height."
774+
)
771775

772776
# FUTURE: Allow option to select if multi-select is allowed or not.
773777
generic_keybindings: GenericKeybinding = Field(
@@ -916,7 +920,7 @@ def check_keybinding_overlaps(self) -> Self:
916920

917921

918922
def get_default_settings() -> Settings:
919-
return Settings.construct()
923+
return Settings.model_construct()
920924

921925

922926
def get_default_settings_yaml(as_comments: bool) -> str:

tests/test_docs.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
from isd_tui.isd import render_model_as_yaml, get_default_settings
2+
from rich.traceback import install
3+
4+
install(show_locals=True)
5+
6+
7+
def test_render_model():
8+
render_model_as_yaml(get_default_settings())

0 commit comments

Comments
 (0)