histui/documentation/specification.md

174 lines
3.4 KiB
Markdown
Raw Normal View History

2024-02-10 12:28:29 -05:00
# CRITICAL NOTES
+ flex might be total overkill as scanf might entirely suffice
2024-02-10 12:25:51 -05:00
# Used technologies
+ C style C++ with pottential future "back" porting
+ flex history parsers
+ SQLite
+ ncurses
+ readline
# Rationale
### C/C++
+ fuck pust
### NCurses
+ i know nothing better that is:
- portable
- reliable
- C compatible
- anyway better than ncurses
### SQLite
+ sharing history between shell types could be desirable, this is the simplest approach
+ having our own storage means that we could support meta informations globally
which are not standard for every application
### Flex
+ its *actually* reusable
### Readline
+ we are not trying to replace it in anyways; it only makes sense
# CLI
2024-02-10 12:44:19 -05:00
```
histui <verb>
<import> <file-1>:<file-2> [format]
<export> <file> [format]
<tui> <file> [options]
<init> <shell>
```
2024-02-10 12:25:51 -05:00
## Import
Read history entries from \<file-1\> into
histuidb \<file-2\>.
Unless all lines are pure entry values,
a format will have to be specified.
If no files are specified,
precomposed formats shall be printed.
E.g. format for "Bash with timestamps".
## Export
Dump the contents of histuidb \<file\>
2024-02-10 12:32:31 -05:00
to stdout using [format].
2024-02-10 12:25:51 -05:00
## Init
Used for printing reasonable default configuration
for using histui with the selected shell.
2024-02-10 12:32:31 -05:00
The default configuration,
if possible should have the following features:
+ override history search with invoking histui
+ sync further commands a histuidb
2024-02-10 12:25:51 -05:00
If no shell is specified,
the available options shall be printed.
# TUI
2024-02-10 12:44:19 -05:00
```
2024-02-10 12:25:51 -05:00
$ histui tui [options]
--command : start in search mode
--normal : start in normal mode
2024-02-10 12:44:19 -05:00
```
2024-02-10 12:25:51 -05:00
2024-02-10 12:44:19 -05:00
```
2024-02-10 12:25:51 -05:00
+---+---------------+
| p | |
| o | listing |
| s | |
+---+---------------+
| ruler |
+-------------------+
| input |
+-------------------+
2024-02-10 12:44:19 -05:00
```
2024-02-10 12:25:51 -05:00
2024-02-10 13:28:41 -05:00
#### Input
2024-02-10 12:25:51 -05:00
**<inspect>**
Select an entry to load the context for.
Without filtering this is effectless,
however if the output was filtered,
the search results are overwritten
by the commands that were executed
in the same shell as this one.
**<clear>**
Clear any filtering or inspection.
**<pop>**
Pop result frame.
**<select>**
Echo entry value and exit with success.
2024-02-10 13:28:41 -05:00
### Result stack
Everytime the user issues a search,
or inspects an item
the result stack is pushed.
The top search frame can/will be
overwritten.
The user may pop or clear by hand.
The result stack is NOT persistent between sessions.
2024-02-10 12:25:51 -05:00
## Format
2024-02-10 12:44:19 -05:00
2024-02-10 12:25:51 -05:00
```
%[flags][width]<specifier>
```
2024-02-10 13:27:08 -05:00
#### Flags
2024-02-10 12:44:19 -05:00
```
2024-02-10 12:25:51 -05:00
- : left-justify within [width]
2024-02-10 13:28:41 -05:00
# : relative (has effect on time specifiers)
2024-02-10 12:44:19 -05:00
```
2024-02-10 12:25:51 -05:00
2024-02-10 13:27:08 -05:00
#### Width
2024-02-10 12:25:51 -05:00
+ number of characters to align to
2024-02-10 13:27:08 -05:00
#### Specifiers
2024-02-10 12:42:05 -05:00
These specifiers root mainly from the C stdlib.
2024-02-10 12:44:19 -05:00
```
2024-02-10 12:25:51 -05:00
s : history entry
n : entry number
p : shell id
a : short weekday name
A : full weekday name
u : ISO 8601 decimal week day weekday (1-7)
b : short month name
B : full month name
2024-02-10 13:27:08 -05:00
C : year (integer) devided by 100
d : day of the month; 0 padded {"09"}
2024-02-10 12:25:51 -05:00
D : short date ("MM/DD/YY")
H : hour in 24h format {18}
I : hour in 12h format {06}; 0 padded
r : 12h time {12:38:21 PM}
R : 24h time ("HH:MM")
S : seconds; 0 padded {04}
M : minutes; 0 padded {03}
T : ISO 8601 time format ("HH:MM:SS")
2024-02-10 12:44:19 -05:00
```
2024-02-10 12:32:31 -05:00
# Environment
2024-02-10 12:54:17 -05:00
HISTUIFILE : histuidb to be used
2024-02-10 13:27:08 -05:00
+---+---------------+
| p | ssh nigger |
| o | ssh hot@nigger|
| s | ssh nigger1 |
+---+---------------+
| ruler |
+-------------------+
| ssh nigger |
+-------------------+