Skip to content

Commit

Permalink
WIP config
Browse files Browse the repository at this point in the history
  • Loading branch information
e3rd committed Jul 25, 2024
1 parent b993277 commit 157c431
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 deletions.
28 changes: 21 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@

Write the program core, do not bother with the input/output.

![hello world example as GUI](asset/hello-world.png "A minimal use case – GUI")
![hello world example as TUI](asset/hello-tui.webp "A minimal use case – TUI")
![Hello world example: GUI window](asset/hello-world.png "A minimal use case – GUI")
![Hello world example: TUI fallback](asset/hello-tui.webp "A minimal use case – TUI fallback")


Check out the code that displays such window, just the code you need. No lengthy blocks of code imposed by an external dependency.

Check out the code that displays such window or its textual fallback.

```python
from dataclasses import dataclass
Expand All @@ -27,6 +28,21 @@ if __name__ == "__main__":
print(args.important_number) # suggested by the IDE with the hint text "This number is very important"
```

It's all the code you need. No lengthy blocks of code imposed by an external dependency. Besides the GUI/TUI, you receive powerful YAML-configurable CLI parsing.

```bash
$ ./hello.py
usage: My application [-h] [--test | --no-test] [--important-number INT]

Set of options.

╭─ options ──────────────────────────────────────────────────────────╮
│ -h, --help show this help message and exit
│ --test, --no-test My testing flag (default: False) │
│ --important-number INT This number is very important (default: 4) │
╰────────────────────────────────────────────────────────────────────╯
```

Or bound the interface to a `with` statement that redirects stdout directly to the window.

```python
Expand All @@ -35,16 +51,14 @@ with run(Config) as m:
boolean = m.is_yes("Is that alright?")
```

TODO img
![Small window with the text 'Your important number'](asset/hello-with-statement.webp "With statement to redirect the output")

Loading config file is a piece of cake. Alongside `program.py`, put `program.yaml`. Instantly loaded.
Loading config file is a piece of cake. Alongside `program.py`, put `program.yaml` and put there some of the arguments. Instantly loaded.

```yaml
important_number: 555
```
TODO img
- [Mininterface – GUI, TUI, CLI and config](#mininterface-gui-tui-cli-and-config)
- [Background](#background)
- [Installation](#installation)
Expand Down
Binary file added asset/hello-with-statement.webp
Binary file not shown.

0 comments on commit 157c431

Please sign in to comment.