xaizek / hstr (License: Apachev2) (since 2018-12-07)
Bash and Zsh shell history suggest box - easily view, navigate, search and manage your command history.
Commit 85909ec588cdd6a85dd813e2f86208a45cbaac4c

Fixing bug #238 - delete confirmation can be disabled by env variable e.g. export HH_CONFIG=noconfirm
Author: Martin Dvorak
Author date (UTC): 2018-01-03 11:40
Committer name: Martin Dvorak
Committer date (UTC): 2018-01-03 11:41
Parent(s): 079d8f9ac120b48355f31fc513aa0fa3e0cc916b
Signing key:
Tree: db944256c14787c764bacc9f044cdc42a69bca3b
File Lines added Lines deleted
man/hh.1 3 0
src/hstr.c 10 3
File man/hh.1 changed (mode: 100644) (index 856b077..ff0f0a5)
... ... Configuration options:
95 95 \fIprompt-bottom\fR \fIprompt-bottom\fR
96 96 Show prompt at the bottom of the screen (default is prompt at the top). Show prompt at the bottom of the screen (default is prompt at the top).
97 97
98 \fInoconfirm\fR
99 Do not ask for confirmation on a history entry delete (default is with confirmation).
100
98 101 \fIregexp\fR \fIregexp\fR
99 102 Filter command history using regular expressions (substring match is default) Filter command history using regular expressions (substring match is default)
100 103
File src/hstr.c changed (mode: 100644) (index a1059d8..80b18d2)
103 103 #define HH_CONFIG_KEYWORDS "keywords" #define HH_CONFIG_KEYWORDS "keywords"
104 104 #define HH_CONFIG_SORTING "rawhistory" #define HH_CONFIG_SORTING "rawhistory"
105 105 #define HH_CONFIG_FAVORITES "favorites" #define HH_CONFIG_FAVORITES "favorites"
106 #define HH_CONFIG_NOCONFIRM "noconfirm"
106 107 // MVP: model is the same regardless prompt is top or bottom - view is different // MVP: model is the same regardless prompt is top or bottom - view is different
107 108 #define HH_CONFIG_PROMPT_BOTTOM "prompt-bottom" #define HH_CONFIG_PROMPT_BOTTOM "prompt-bottom"
108 109 #define HH_CONFIG_BLACKLIST "blacklist" #define HH_CONFIG_BLACKLIST "blacklist"
 
... ... typedef struct {
274 275
275 276 unsigned char theme; unsigned char theme;
276 277 bool keepPage; // do NOT clear page w/ selection on HH exit bool keepPage; // do NOT clear page w/ selection on HH exit
278 bool noConfirm; // do NOT ask for confirmation on history entry delete
277 279 int bigKeys; int bigKeys;
278 280 int debugLevel; int debugLevel;
279 281
 
... ... void hstr_get_env_configuration(Hstr *hstr)
383 385 if(strstr(hstr_config,HH_CONFIG_KEEP_PAGE)) { if(strstr(hstr_config,HH_CONFIG_KEEP_PAGE)) {
384 386 hstr->keepPage=true; hstr->keepPage=true;
385 387 } }
388 if(strstr(hstr_config,HH_CONFIG_NOCONFIRM)) {
389 hstr->noConfirm=true;
390 }
386 391
387 392 if(strstr(hstr_config,HH_CONFIG_DEBUG)) { if(strstr(hstr_config,HH_CONFIG_DEBUG)) {
388 393 hstr->debugLevel=HH_DEBUG_LEVEL_DEBUG; hstr->debugLevel=HH_DEBUG_LEVEL_DEBUG;
 
... ... void loop_to_select(Hstr *hstr)
1057 1062 msg=malloc(strlen(delete)+1); msg=malloc(strlen(delete)+1);
1058 1063 strcpy(msg,delete); strcpy(msg,delete);
1059 1064
1060 print_confirm_delete(msg, hstr);
1061 cc = wgetch(stdscr);
1062 if(cc == 'y') {
1065 if(!hstr->noConfirm) {
1066 print_confirm_delete(msg, hstr);
1067 cc = wgetch(stdscr);
1068 }
1069 if(hstr->noConfirm || cc == 'y') {
1063 1070 deletedOccurences=remove_from_history_model(msg, hstr); deletedOccurences=remove_from_history_model(msg, hstr);
1064 1071 result=hstr_print_selection(maxHistoryItems, pattern, hstr); result=hstr_print_selection(maxHistoryItems, pattern, hstr);
1065 1072 print_cmd_deleted_label(msg, deletedOccurences, hstr); print_cmd_deleted_label(msg, deletedOccurences, hstr);
Hints

Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://code.reversed.top/user/xaizek/hstr

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@code.reversed.top/user/xaizek/hstr

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a pull request:
... clone the repository ...
... make some changes and some commits ...
git push origin master