mirror of
https://github.com/daylinmorgan/hwylterm.git
synced 2024-12-23 03:20:44 -06:00
Compare commits
2 commits
7e82f7ba5a
...
be17fc6bc9
Author | SHA1 | Date | |
---|---|---|---|
be17fc6bc9 | |||
e175cf1fc9 |
3 changed files with 27 additions and 2 deletions
|
@ -10,5 +10,5 @@
|
||||||
|
|
||||||
]##
|
]##
|
||||||
|
|
||||||
import hwylterm/[spin, bbansi]
|
import hwylterm/[spin, bbansi, confirm]
|
||||||
export spin, bbansi
|
export spin, bbansi, confirm
|
||||||
|
|
21
src/hwylterm/confirm.nim
Normal file
21
src/hwylterm/confirm.nim
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
import std/[strutils]
|
||||||
|
import ./bbansi
|
||||||
|
|
||||||
|
proc confirm*(
|
||||||
|
question: string,
|
||||||
|
prefix = "",
|
||||||
|
suffix = ""
|
||||||
|
): bool =
|
||||||
|
result = false
|
||||||
|
stderr.write $(question & bb"[yellow] (Y/n) ")
|
||||||
|
while true:
|
||||||
|
let ans = readLine(stdin)
|
||||||
|
case ans.strip().toLowerAscii():
|
||||||
|
of "y","yes": return true
|
||||||
|
of "n","no": return false
|
||||||
|
else:
|
||||||
|
stderr.write($bb("[red]Please answer Yes/no\nexpected one of [b]Y,yes,N,no "))
|
||||||
|
stderr.write "\n"
|
||||||
|
|
||||||
|
when isMainModule:
|
||||||
|
echo "Response: ", confirm("Is it working?")
|
4
todo.md
4
todo.md
|
@ -11,6 +11,7 @@
|
||||||
- [ ] consider reducing illwill surface to only relevant IO (input) features
|
- [ ] consider reducing illwill surface to only relevant IO (input) features
|
||||||
- [ ] revamp spinner api
|
- [ ] revamp spinner api
|
||||||
- [x] add Bbstring ~~indexing operations~~ strutils, that are span aware
|
- [x] add Bbstring ~~indexing operations~~ strutils, that are span aware
|
||||||
|
- [ ] add a `commands` option for `newHwylCli` in `hwylterm/cli`
|
||||||
|
|
||||||
## features
|
## features
|
||||||
|
|
||||||
|
@ -22,5 +23,8 @@
|
||||||
- [ ] support for rgb colors
|
- [ ] support for rgb colors
|
||||||
- [ ] modify 256 colors w/parser changes to be `"[color(9)]red"` instead of `[9]red`
|
- [ ] modify 256 colors w/parser changes to be `"[color(9)]red"` instead of `[9]red`
|
||||||
- [x] improve color detection [ref](https://github.com/Textualize/rich/blob/4101991898ee7a09fe1706daca24af5e1e054862/rich/console.py#L791)
|
- [x] improve color detection [ref](https://github.com/Textualize/rich/blob/4101991898ee7a09fe1706daca24af5e1e054862/rich/console.py#L791)
|
||||||
|
## testing
|
||||||
|
|
||||||
|
- [ ] investigate [cap10](https://github.com/crashappsec/cap10) as a means of scripting the testing
|
||||||
|
|
||||||
<!-- generated with <3 by daylinmorgan/todo -->
|
<!-- generated with <3 by daylinmorgan/todo -->
|
||||||
|
|
Loading…
Reference in a new issue