Skip to content

Commit

Permalink
✨ improved interactive functions
Browse files Browse the repository at this point in the history
  • Loading branch information
jcaillon committed Jul 7, 2024
1 parent e72c80b commit a73b90e
Show file tree
Hide file tree
Showing 12 changed files with 224 additions and 84 deletions.
5 changes: 5 additions & 0 deletions docs/content/docs/800.roadmap/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ This page lists the features that I would like to implement in Valet. They come
- add valet in brew
- For argument and option autocompletion, accept any multiline string that will be eval and that should set RETURNED_ARRAY with the list of possible completion.
- allow to do that: `eval "$(valet self uninstall)"` to clean everything up
- implement a long running task wait spinner using coproc
- functions:
- head / tail from file.
- test if folder is writeable
- Implement regex replace in pure bash.


[valet-issues]: https://github.com/jcaillon/valet/issues
34 changes: 34 additions & 0 deletions docs/content/docs/800.roadmap/_index.md.BASE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
title: 🔭 Roadmap
cascade:
type: docs
weight: 800
url: /docs/roadmap
---

This page lists the features that I would like to implement in Valet. They come in addition to new features described in the [issues][valet-issues].

- Improve the self install script / check for updates by comparing the version number / suggest the user to git pull the repositories existing under .valet.d. Also add snippets and all functions...
- rebuild
- add path to valet on windows as well
- Add full support for interactive mode.
- For dropdown with a set list of options, we can verify that the input value is one of the expected value.
- Generate an autocompletion script for bash and zsh.
- Self-command to create a new command interactively.
- Create a valet-community-commands where everyone can contribute to new default commands for Valet.
- Add a command self package that build the user commands into a single script file.
- fix running tests with verbose mode on.
- Have a consistent look and feel for interactive functions.
- Reimplement usage of main::sortCommands / main::addLastChoice.
- Betters checks in self build!
- A command can declare dependencies to auto check if some tools are installed before running the command.
- add valet in brew
- For argument and option autocompletion, accept any multiline string that will be eval and that should set RETURNED_ARRAY with the list of possible completion.
- allow to do that: `eval "$(valet self uninstall)"` to clean everything up
- functions:
- head / tail from file.
- test if folder is writeable
- Implement regex replace in pure bash.


[valet-issues]: https://github.com/jcaillon/valet/issues
33 changes: 33 additions & 0 deletions docs/content/docs/800.roadmap/_index.md.LOCAL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
title: 🔭 Roadmap
cascade:
type: docs
weight: 800
url: /docs/roadmap
---

This page lists the features that I would like to implement in Valet. They come in addition to new features described in the [issues][valet-issues].

- Improve the self install script / check for updates by comparing the version number / suggest the user to git pull the repositories existing under .valet.d. Also add snippets and all functions...
- rebuild
- add path to valet on windows as well
- Add full support for interactive mode.
- For dropdown with a set list of options, we can verify that the input value is one of the expected value.
- Generate an autocompletion script for bash and zsh.
- Self-command to create a new command interactively.
- Create a valet-community-commands where everyone can contribute to new default commands for Valet.
- head / tail from file.
- Add a command self package that build the user commands into a single script file.
- fix running tests with verbose mode on.
- Have a consistent look and feel for interactive functions.
- Reimplement usage of main::sortCommands / main::addLastChoice.
- Implement regex replace in pure bash.
- Betters checks in self build!
- A command can declare dependencies to auto check if some tools are installed before running the command.
- Add test:: and also add a snippet to create a new function.
- add valet in brew
- For argument and option autocompletion, accept any multiline string that will be eval and that should set RETURNED_ARRAY with the list of possible completion.
- allow to do that: `eval "$(valet self uninstall)"` to clean everything up


[valet-issues]: https://github.com/jcaillon/valet/issues
35 changes: 35 additions & 0 deletions docs/content/docs/800.roadmap/_index.md.REMOTE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
title: 🔭 Roadmap
cascade:
type: docs
weight: 800
url: /docs/roadmap
---

This page lists the features that I would like to implement in Valet. They come in addition to new features described in the [issues][valet-issues].

- Improve the self install script / check for updates by comparing the version number / suggest the user to git pull the repositories existing under .valet.d. Also add snippets and all functions...
- rebuild
- add path to valet on windows as well
- Add full support for interactive mode.
- For dropdown with a set list of options, we can verify that the input value is one of the expected value.
- Generate an autocompletion script for bash and zsh.
- Self-command to create a new command interactively.
- Create a valet-community-commands where everyone can contribute to new default commands for Valet.
- Add a command self package that build the user commands into a single script file.
- fix running tests with verbose mode on.
- Have a consistent look and feel for interactive functions.
- Reimplement usage of main::sortCommands / main::addLastChoice.
- Betters checks in self build!
- A command can declare dependencies to auto check if some tools are installed before running the command.
- add valet in brew
- For argument and option autocompletion, accept any multiline string that will be eval and that should set RETURNED_ARRAY with the list of possible completion.
- allow to do that: `eval "$(valet self uninstall)"` to clean everything up
- implement a long running task wait spinner using coproc
- functions:
- head / tail from file.
- test if folder is writeable
- Implement regex replace in pure bash.


[valet-issues]: https://github.com/jcaillon/valet/issues
2 changes: 1 addition & 1 deletion examples.d/showcase/showcase-interactive.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function showcaseInteractive() {
# log::info "Getting user input"

log::info "Displaying an answer box."
interactive::displayAnswer "My favorite color is blue."
interactive::displayAnswer "My favorite color is blue. fçeuzh _uhze ueo_uifhezruh uezh ruhezrfuh eziufhezru hfezurh uezrhf uezhf euhrzf ezurhf oiuezrhsssqqqq1234"

log::info "Getting user confirmation:"
interactive::askForConfirmation "Please press ENTER to continue."
Expand Down
4 changes: 2 additions & 2 deletions tests.d/1005-lib-io/00.tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ function testIo::isDirectoryWritable() {
echo "Not writable"
fi

echo "→ io::isDirectoryWritable '/notexisting'"
if io::isDirectoryWritable '/notexisting'; then
echo "→ io::isDirectoryWritable '/tmp/notexisting'"
if io::isDirectoryWritable '/tmp/notexisting'; then
echo "Writable"
else
echo "Not writable"
Expand Down
4 changes: 2 additions & 2 deletions tests.d/1005-lib-io/results.approved.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,8 @@ Exit code: `0`
```plaintext
→ io::isDirectoryWritable '/tmp'
Writable
→ io::isDirectoryWritable '/notexisting'
Not writable
→ io::isDirectoryWritable '/tmp/notexisting'
Writable
```

## Test script 01.invoke
Expand Down
30 changes: 15 additions & 15 deletions tests.d/1007-lib-interactive/results.approved.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ Exit code: `0`

```plaintext
echo y | interactive::promptYesNo 'Do you see this message?'
[2m─[24b─┐[0m
[2m [0mDo you see this message? [28G[2m│[0m
[2m─[24b─┘[0m
[2m─[24b─┐[0m
[2m░──┤[0m Do you see this message? [31G[2m│[0m
[2m─[24b─┘[0m

[1F[?25l[7m (Y)ES [0m (N)O [0m[1G[0K[?25h[2m[9992G┌─[4b─[0m
[2m[9992G│[0m Yes.[2m[0m
[2m[9992G└─[4b─[0m
[1F[?25l[7m (Y)ES [0m (N)O [0m[1G[0K[?25h[2m[9G┌─[4b─[0m
[2m[9G│[0m Yes. [16G[2m├──░[0m
[2m[9G└─[4b─[0m
```

### Testing interactive::promptYesNo
Expand All @@ -28,13 +28,13 @@ Exit code: `1`
```plaintext
echo n | interactive::promptYesNo 'Do you see this message?'
[2m─[24b─┐[0m
[2m [0mDo you see this message? [28G[2m│[0m
[2m─[24b─┘[0m
[2m─[24b─┐[0m
[2m░──┤[0m Do you see this message? [31G[2m│[0m
[2m─[24b─┘[0m

[1F[?25l[7m (Y)ES [0m (N)O [0m[1G[0K[?25h[2m[9993G┌─[3b─[0m
[2m[9993G│[0m No.[2m[0m
[2m[9993G└─[3b─[0m
[1F[?25l[7m (Y)ES [0m (N)O [0m[1G[0K[?25h[2m[9G┌─[3b─[0m
[2m[9G│[0m No. [15G[2m├──░[0m
[2m[9G└─[3b─[0m
```

### test interactive::askForConfirmation with yes
Expand All @@ -45,9 +45,9 @@ Exit code: `0`

```plaintext
echo y | interactive::askForConfirmation 'Please press OK.'
[2m─[16b─┐[0m
[2m [0mPlease press OK. [20G[2m│[0m
[2m─[16b─┘[0m
[2m─[16b─┐[0m
[2m░──┤[0m Please press OK. [23G[2m│[0m
[2m─[16b─┘[0m

[?25l (O)K [?25h
```
Expand Down
66 changes: 33 additions & 33 deletions tests.d/1104-self-setup/results.approved.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,34 +14,34 @@ Exit code: `0`
CINThis is a COLOR CHECK, this line should be COLORED (in cyan by default).CDE
CSUThis is a COLOR CHECK, this line should be COLORED (in green by default).CDE
─────────────────────────────────────
[2m─[56b─┐[0m
[2m [0mDo you see the colors in the color check above the line? [60G[2m│[0m
[2m─[56b─┘[0m
[2m─[56b─┐[0m
[2m░──┤[0m Do you see the colors in the color check above the line? [63G[2m│[0m
[2m─[56b─┘[0m

[1F[?25l[7m (Y)ES [0m (N)O [0m[1G[0K[?25h[2m[9993G┌─[3b─[0m
[2m[9993G│[0m No.[2m[0m
[2m[9993G└─[3b─[0m
[1F[?25l[7m (Y)ES [0m (N)O [0m[1G[0K[?25h[2m[9G┌─[3b─[0m
[2m[9G│[0m No. [15G[2m├──░[0m
[2m[9G└─[3b─[0m
─────────────────────────────────────
This is a nerd icon check, check out the next lines:
A cross within a square: IE
A warning sign: IW
A checked box: IS
An information icon: II
─────────────────────────────────────
[2m─[69b─┐[0m
[2m [0mDo you correctly see the nerd icons in the icon check above the line? [73G[2m│[0m
[2m─[69b─┘[0m
[2m─[69b─┐[0m
[2m░──┤[0m Do you correctly see the nerd icons in the icon check above the line? [76G[2m│[0m
[2m─[69b─┘[0m

[1F[?25l (Y)ES [0m [7m (N)O [0m[1G[0K[?25h[2m[9993G┌─[3b─[0m
[2m[9993G│[0m No.[2m[0m
[2m[9993G└─[3b─[0m
[2m─[41b─┐[0m
[2m [0mDo you want to enable the icons in Valet? [45G[2m│[0m
[2m─[41b─┘[0m
[1F[?25l (Y)ES [0m [7m (N)O [0m[1G[0K[?25h[2m[9G┌─[3b─[0m
[2m[9G│[0m No. [15G[2m├──░[0m
[2m[9G└─[3b─[0m
[2m─[41b─┐[0m
[2m░──┤[0m Do you want to enable the icons in Valet? [48G[2m│[0m
[2m─[41b─┘[0m

[1F[?25l (Y)ES [0m [7m (N)O [0m[1G[0K[?25h[2m[9993G┌─[3b─[0m
[2m[9993G│[0m No.[2m[0m
[2m[9993G└─[3b─[0m
[1F[?25l (Y)ES [0m [7m (N)O [0m[1G[0K[?25h[2m[9G┌─[3b─[0m
[2m[9G│[0m No. [15G[2m├──░[0m
[2m[9G└─[3b─[0m
```

**Error** output:
Expand Down Expand Up @@ -73,30 +73,30 @@ Exit code: `0`
CINThis is a COLOR CHECK, this line should be COLORED (in cyan by default).CDE
CSUThis is a COLOR CHECK, this line should be COLORED (in green by default).CDE
─────────────────────────────────────
[2m─[56b─┐[0m
[2m [0mDo you see the colors in the color check above the line? [60G[2m│[0m
[2m─[56b─┘[0m
[2m─[56b─┐[0m
[2m░──┤[0m Do you see the colors in the color check above the line? [63G[2m│[0m
[2m─[56b─┘[0m

[1F[?25l[7m (Y)ES [0m (N)O [0m[1G[0K[?25h[2m[9992G┌─[4b─[0m
[2m[9992G│[0m Yes.[2m[0m
[2m[9992G└─[4b─[0m
[1F[?25l[7m (Y)ES [0m (N)O [0m[1G[0K[?25h[2m[9G┌─[4b─[0m
[2m[9G│[0m Yes. [16G[2m├──░[0m
[2m[9G└─[4b─[0m
─────────────────────────────────────
This is a nerd icon check, check out the next lines:
A cross within a square: IE
A warning sign: IW
A checked box: IS
An information icon: II
─────────────────────────────────────
[2m─[69b─┐[0m
[2m [0mDo you correctly see the nerd icons in the icon check above the line? [73G[2m│[0m
[2m─[69b─┘[0m
[2m─[69b─┐[0m
[2m░──┤[0m Do you correctly see the nerd icons in the icon check above the line? [76G[2m│[0m
[2m─[69b─┘[0m

[1F[?25l[7mCUB (Y)ES [0m [7mCAB (N)O [0m[1G[0K[?25h[2m[9992G┌─[4b─[0m
[2m[9992G│[0m Yes.[2m[0m
[2m[9992G└─[4b─[0m
[2m─[32b─┐[0m
[2m [0mDid you read the warnings above? [36G[2m│[0m
[2m─[32b─┘[0m
[1F[?25l[7mCUB (Y)ES [0m [7mCAB (N)O [0m[1G[0K[?25h[2m[9G┌─[4b─[0m
[2m[9G│[0m Yes. [16G[2m├──░[0m
[2m[9G└─[4b─[0m
[2m─[32b─┐[0m
[2m░──┤[0m Did you read the warnings above? [39G[2m│[0m
[2m─[32b─┘[0m

[?25lCAB (O)K [?25h
```
Expand Down
Loading

0 comments on commit a73b90e

Please sign in to comment.