New upstream version 2.5+ds
Daniel Echeverri
2 years ago
0 | 2021-12-13 Martin Dvorak <martin.dvorak@mindforger.com> | |
1 | ||
2 | * Released v2.5.0 - minor fix release to fix Arch build. | |
3 | ||
4 | 2021-12-03 Martin Dvorak <martin.dvorak@mindforger.com> | |
5 | ||
6 | * Released v2.4.0 - ability to insert custom command to terminal prompt, | |
7 | minor fixes. | |
8 | ||
0 | 9 | 2020-11-19 Martin Dvorak <martin.dvorak@mindforger.com> |
1 | 10 | |
2 | 11 | * Released v2.3.0 - zsh timestamp extended history parsing and SEGFAULT fixes. |
8 | 8 | * [RHEL](#fedorarhelcentosscientific) |
9 | 9 | * [Debian](#debianmint) |
10 | 10 | * [Mint](#debianmint) |
11 | * [Alpine Linux](#alpine-linux) | |
11 | 12 | * [Arch Linux](#archmanjaro-linux) |
12 | 13 | * [Milis Linux](#milis-linux) |
13 | 14 | * [Manjaro Linux](#archmanjaro-linux) |
31 | 32 | Tarball: |
32 | 33 | |
33 | 34 | * [build and install tarball](#build-and-install-tarball) |
35 | ||
36 | Upgrade: | |
37 | ||
38 | * [HSTR 1.x to 2.x](#upgrade) | |
34 | 39 | # Install |
35 | Install HSTR using a package. | |
36 | ||
40 | Install HSTR using a [package](https://pkgs.org/search/?q=hstr) or repository. | |
37 | 41 | ## Ubuntu |
38 | Install HSTR on Ubuntu using one-liner: | |
42 | HSTR is [included in Ubuntu 21.10](https://packages.ubuntu.com/impish/utils/hstr) and [newer](https://wiki.ubuntu.com/Releases) releases: | |
43 | ||
44 | ``` | |
45 | sudo apt install hstr | |
46 | ``` | |
47 | ||
48 | --- | |
49 | ||
50 | Install HSTR on **Ubuntu 21.04 and older** using one-liner: | |
39 | 51 | |
40 | 52 | ```bash |
41 | 53 | sudo add-apt-repository ppa:ultradvorka/ppa && sudo apt-get update && sudo apt-get install hstr && hstr --show-configuration >> ~/.bashrc && . ~/.bashrc |
52 | 64 | [Configure](CONFIGURATION.md) HSTR and check its [man page](README.md#documentation). |
53 | 65 | |
54 | 66 | ## Debian/Mint |
55 | Install HSTR from PPA. Add [my PPA](https://www.mindforger.com/debian), | |
67 | HSTR is [included in Debian 11](https://packages.debian.org/bullseye/hstr) and [newer](https://www.debian.org/releases/) releases: | |
68 | ||
69 | ``` | |
70 | sudo apt install hstr | |
71 | ``` | |
72 | ||
73 | --- | |
74 | ||
75 | Install HSTR on **Debian 10 and older** from my PPA. Add [PPA](https://www.mindforger.com/debian), | |
56 | 76 | trust [GPG key](https://www.mindforger.com/gpgpubkey.txt) and install HSTR: |
57 | 77 | |
58 | 78 | ```bash |
77 | 97 | section of the project: |
78 | 98 | |
79 | 99 | ```bash |
80 | wget -O hstr.deb https://github.com/dvorka/hstr/releases/download/2.3/hstr_<major>.<minor>.<revision>-1_amd64.deb | |
100 | wget -O hstr.deb https://github.com/dvorka/hstr/releases/download/<major>.<minor>/hstr_<major>.<minor>.<revision>-1_amd64.deb | |
81 | 101 | |
82 | 102 | # dependencies: |
83 | 103 | apt-get install libncursesw5 libtinfo5 |
87 | 107 | |
88 | 108 | |
89 | 109 | ## Fedora/RHEL/CentOS/Scientific |
90 | Install HSTR on Fedora, RHEL, CentOS or Scientific Linux: | |
110 | Install HSTR on [Fedora](https://src.fedoraproject.org/rpms/hstr), RHEL, CentOS or Scientific Linux: | |
91 | 111 | |
92 | 112 | ```bash |
93 | 113 | sudo dnf install hstr |
103 | 123 | --- |
104 | 124 | |
105 | 125 | If you want to make sure you have the latest version, then download `.rpm` archive from |
106 | [GitHub releases](https://github.com/dvorka/hstr/releases) and install it: | |
126 | [GitHub releases](https://github.com/dvorka/hstr/releases) or [pkgs.org](https://pkgs.org/search/?q=hstr) and install it: | |
107 | 127 | |
108 | 128 | ```bash |
109 | 129 | sudo dnf install ./hstr-<major>.<minor>.<revision>-2.x86_64.rpm |
110 | 130 | ``` |
111 | 131 | |
112 | 132 | ## openSUSE |
113 | To install HSTR on openSUSE, please check https://software.opensuse.org/package/hstr first. You can install HSTR as shown below (just choose repository you like): | |
133 | To install HSTR on openSUSE, please check [software.opensuse.org](https://software.opensuse.org/package/hstr) or [pkgs.org](https://pkgs.org/search/?q=hstr). You can install HSTR as follows: | |
114 | 134 | |
115 | 135 | ```bash |
116 | 136 | zypper addrepo https://download.opensuse.org/repositories/home:lemmy04/openSUSE_Leap_15.1/home:lemmy04.repo |
119 | 139 | ``` |
120 | 140 | |
121 | 141 | [Configure](CONFIGURATION.md) HSTR and check its [man page](README.md#documentation). |
122 | ||
123 | 142 | ## Gentoo |
124 | 143 | To install HSTR on Gentoo run (HSTR has been added to [Portage](https://bugs.gentoo.org/show_bug.cgi?id=527122)): |
125 | 144 | |
129 | 148 | |
130 | 149 | [Configure](CONFIGURATION.md) HSTR and check its [man page](README.md#documentation). |
131 | 150 | |
151 | ## Alpine Linux | |
152 | ||
153 | To install HSTR on Alpine Linux run the following command as root: | |
154 | ||
155 | ```bash | |
156 | apk add hstr | |
157 | ``` | |
158 | ||
159 | [Configure](CONFIGURATION.md) HSTR and check its [man page](README.md#documentation). | |
160 | ||
161 | ## ALT Linux | |
162 | To install HSTR on ALT Linux, please check [pkgs.org](https://pkgs.org/search/?q=hstr). You can install HSTR as follows: | |
163 | ||
164 | ```bash | |
165 | rpm [p10] http://ftp.altlinux.org/pub/distributions/ALTLinux/autoimports/p10 x86_64 autoimports | |
166 | rpm [p10] http://ftp.altlinux.org/pub/distributions/ALTLinux/autoimports/p10 noarch autoimports | |
167 | ||
168 | sudo apt-get update | |
169 | ||
170 | sudo apt-get install hstr | |
171 | ``` | |
172 | ||
173 | [Configure](CONFIGURATION.md) HSTR and check its [man page](README.md#documentation). | |
132 | 174 | ## Arch/Manjaro Linux |
133 | To install HSTR on Arch or Manjaro Linux download the latest distribution from [GitHub releases](https://github.com/dvorka/hstr/releases). | |
175 | To install HSTR on Arch or Manjaro Linux download the latest distribution either from [pkgs.org](https://pkgs.org/search/?q=hstr) or [GitHub releases](https://github.com/dvorka/hstr/releases). | |
134 | 176 | |
135 | 177 | Use [PKGBUILD](https://wiki.archlinux.org/index.php/PKGBUILD) in the root of the distribution to build package using `makepkg`. |
136 | 178 | |
137 | 179 | To install HSTR from the [Arch User Repository (AUR)](https://aur.archlinux.org/packages/hstr-git/) run `yaourt -S hstr-git` in command line. |
138 | 180 | |
181 | ## FreeBSD | |
182 | To install HSTR on FreeBSD, please check [pkgs.org](https://pkgs.org/search/?q=hstr). You can install HSTR as follows: | |
183 | ||
184 | ```bash | |
185 | pkg install hstr | |
186 | ``` | |
187 | ||
188 | [Configure](CONFIGURATION.md) HSTR and check its [man page](README.md#documentation). | |
189 | ## Slackware | |
190 | To install HSTR on Slackware, please check [pkgs.org](https://pkgs.org/search/?q=hstr). You can install HSTR as follows: | |
191 | ||
192 | ```bash | |
193 | upgradepkg --install-new hstr-<major>.<minor>-x86_64-1cf.txz | |
194 | ``` | |
195 | ||
196 | [Configure](CONFIGURATION.md) HSTR and check its [man page](README.md#documentation). | |
197 | ## Void Linux | |
198 | To install HSTR on Void Linux, please check [pkgs.org](https://pkgs.org/search/?q=hstr). You can install HSTR as follows: | |
199 | ||
200 | ```bash | |
201 | xbps-install -Su hstr | |
202 | ``` | |
203 | ||
204 | [Configure](CONFIGURATION.md) HSTR and check its [man page](README.md#documentation). | |
139 | 205 | ## Milis Linux |
140 | 206 | To install HSTR on Milis Linux run the following commands as root: |
141 | 207 | |
265 | 331 | Install dependencies: |
266 | 332 | |
267 | 333 | ```bash |
268 | sudo apt install autotools gcc make libncursesw5-dev libreadline-dev | |
334 | sudo apt install autotools gcc make pkgconf libncursesw5-dev libreadline-dev | |
269 | 335 | ``` |
270 | 336 | |
271 | 337 | Create build files using: |
422 | 488 | ``` |
423 | 489 | |
424 | 490 | [Configure](CONFIGURATION.md) HSTR and check its [man page](README.md#documentation). |
491 | # Upgrade | |
492 | Upgrade HSTR using a [package](https://pkgs.org/search/?q=hstr) or repository. If you are `HSTR 1.x` user, please read about [HSTR 2.x changes](https://github.com/dvorka/hstr/releases/tag/2.0). | |
493 | ||
494 |
3 | 3 | # Contributor: Busindre <busilezas at busindre.com> |
4 | 4 | |
5 | 5 | pkgname=hstr |
6 | pkgver=2.3 | |
6 | pkgver=2.5 | |
7 | 7 | pkgrel=1 |
8 | 8 | pkgdesc="A command line utility that brings improved BASH command completion from the history. It aims to make completion easier and more efficient than Ctrl-r." |
9 | 9 | arch=('any') |
30 | 30 | Install: |
31 | 31 | |
32 | 32 | * [Ubuntu](INSTALLATION.md#ubuntu) |
33 | * [Fedora](INSTALLATION.md#fedorarhelcentosscientific) | |
34 | * [Gentoo](INSTALLATION.md#gentoo) | |
35 | * [CentOS](INSTALLATION.md#fedorarhelcentosscientific) | |
36 | * [openSUSE](INSTALLATION.md#opensuse) | |
37 | * [RHEL](INSTALLATION.md#fedorarhelcentosscientific) | |
38 | 33 | * [Debian](INSTALLATION.md#debianmint) |
39 | 34 | * [Mint](INSTALLATION.md#debianmint) |
40 | * [Arch Linux](INSTALLATION.md#archmanjaro-linux) | |
35 | * [Fedora](INSTALLATION.md#fedorarhelcentosscientific) | |
36 | * [CentOS](INSTALLATION.md#fedorarhelcentosscientific) | |
37 | * [RHEL](INSTALLATION.md#fedorarhelcentosscientific) | |
38 | * [Scientific Linux](INSTALLATION.md#fedorarhelcentosscientific) | |
39 | * [openSUSE](INSTALLATION.md#opensuse) | |
40 | * [Gentoo](INSTALLATION.md#gentoo) | |
41 | * [Alpine Linux](INSTALLATION.md#alpine-linux) | |
42 | * [Arch](INSTALLATION.md#archmanjaro-linux) | |
41 | 43 | * [Manjaro Linux](INSTALLATION.md#archmanjaro-linux) |
42 | * [Scientific Linux](INSTALLATION.md#fedorarhelcentosscientific) | |
44 | * [FreeBSD](INSTALLATION.md#freebsd) | |
45 | * [Slackware Linux](INSTALLATION.md#slackware) | |
46 | * [Void Linux](INSTALLATION.md#void-linux) | |
47 | * [Milis Linux](INSTALLATION.md#milis-linux) | |
43 | 48 | * [Haiku OS](INSTALLATION.md#haiku-os) |
44 | 49 | * [macOS](INSTALLATION.md#macos) |
45 | 50 | * [nix package manager](INSTALLATION.md#nix-package-manager) |
60 | 65 | |
61 | 66 | * [build and install tarball](INSTALLATION.md#build-and-install-tarball) |
62 | 67 | |
68 | Check also [packages](https://pkgs.org/search/?q=hstr) for Linux and Unix. | |
63 | 69 | |
64 | 70 | ## Configuration |
65 | 71 | Configure HSTR just by running: |
74 | 80 | For detailed HSTR configuration documentation please refer to [Configuration](CONFIGURATION.md). |
75 | 81 | |
76 | 82 | |
83 | ## In the News | |
84 | Read about HSTR in [LinuxMagazine](http://www.linux-magazine.com/Issues/2014/164/Bash-History-on-Steroids), [UbuntuGeek](http://www.ubuntugeek.com/tag/hstr-bash-history), [DebianAdmin](http://www.debianadmin.com/hstr-easily-view-navigate-search-and-use-your-command-history-with-shell-history.html), [Tuxdiary](http://tuxdiary.com/2015/02/17/hstr/), [Softpedia](http://linux.softpedia.com/get/Terminals/BASH-Command-History-Completion-103155.shtml) and [OSTechNix](https://www.ostechnix.com/hstr-easily-view-navigate-search-manage-commandline-history/). | |
85 | ||
86 | ||
77 | 87 | ## Documentation |
78 | 88 | Check man page: |
79 | 89 | |
81 | 91 | man hstr |
82 | 92 | ``` |
83 | 93 | |
84 | ## In the News | |
85 | Read about HSTR in [LinuxMagazine](http://www.linux-magazine.com/Issues/2014/164/Bash-History-on-Steroids), [UbuntuGeek](http://www.ubuntugeek.com/tag/hstr-bash-history), [DebianAdmin](http://www.debianadmin.com/hstr-easily-view-navigate-search-and-use-your-command-history-with-shell-history.html), [Tuxdiary](http://tuxdiary.com/2015/02/17/hstr/), [Softpedia](http://linux.softpedia.com/get/Terminals/BASH-Command-History-Completion-103155.shtml) and [OSTechNix](https://www.ostechnix.com/hstr-easily-view-navigate-search-manage-commandline-history/). | |
86 | ||
87 | ||
88 | ## Upgrade | |
89 | If you are HSTR 1.x user, please read about [HSTR 2.x changes](https://github.com/dvorka/hstr/releases/tag/2.0). | |
90 | ||
91 | ||
94 | User videos: [Zack](https://www.youtube.com/watch?v=Qd75pIeQkH8), [Dvorka](https://www.youtube.com/watch?v=sPF29NyXe2U) and [Yu-Jie Lin](https://www.youtube.com/watch?v=Qx5n_5B5xUw). | |
92 | 95 | ## Bugs |
93 | 96 | https://github.com/dvorka/hstr/issues |
0 | # Security Policy | |
1 | ||
2 | ## Supported Versions | |
3 | ||
4 | The following HSTR versions are currently being supported with security updates. | |
5 | ||
6 | | Version | Supported | | |
7 | | ------- | ------------------ | | |
8 | | 2.5.0 | :white_check_mark: | | |
9 | | 2.4.0 | :white_check_mark: | | |
10 | | <= 2.3.0 | :x: | | |
11 | ||
12 | ## Reporting a Vulnerability | |
13 | ||
14 | Please report HSTR vulnerabilities to | |
15 | [martin.dvorak@mindforger.com](martin.dvorak@mindforger.com) | |
16 | ||
17 | All reported vulnerabilities will be examined, reproduced and | |
18 | expected fix release and release date will be shared with | |
19 | the reporter. |
0 | 0 | # configure.ac Autoconf configuration file |
1 | 1 | # |
2 | # Copyright (C) 2014-2020 Martin Dvorak <martin.dvorak@mindforger.com> | |
2 | # Copyright (C) 2014-2021 Martin Dvorak <martin.dvorak@mindforger.com> | |
3 | 3 | # |
4 | 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
5 | 5 | # you may not use this file except in compliance with the License. |
19 | 19 | |
20 | 20 | AC_PREREQ([2.69]) |
21 | 21 | |
22 | AC_INIT(hstr, 2.3.0, martin.dvorak@mindforger.com) | |
22 | AC_INIT(hstr, 2.5.0, martin.dvorak@mindforger.com) | |
23 | 23 | AC_CONFIG_FILES([Makefile src/Makefile man/Makefile]) |
24 | 24 | |
25 | 25 | # Check src dir existence. |
0 | 0 | #!/bin/bash |
1 | 1 | # |
2 | # Copyright (C) 2014-2020 Martin Dvorak <martin.dvorak@mindforger.com> | |
2 | # Copyright (C) 2014-2021 Martin Dvorak <martin.dvorak@mindforger.com> | |
3 | 3 | # |
4 | 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
5 | 5 | # you may not use this file except in compliance with the License. |
0 | 0 | # hstr.pro Qt project file for HSTR shell history compleation utility |
1 | 1 | # |
2 | # Copyright (C) 2014-2020 Martin Dvorak <martin.dvorak@mindforger.com> | |
2 | # Copyright (C) 2014-2021 Martin Dvorak <martin.dvorak@mindforger.com> | |
3 | 3 | # |
4 | 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
5 | 5 | # you may not use this file except in compliance with the License. |
22 | 22 | .TP |
23 | 23 | \fB-k --kill-last-command\fR |
24 | 24 | Delete the last command from history and exit |
25 | .TP | |
26 | \fB-i --insert-in-terminal=[command]\fR | |
27 | Insert custom command to terminal prompt and exit | |
25 | 28 | .TP |
26 | 29 | \fB-f --favorites\fR |
27 | 30 | Show favorites view immediately |
220 | 223 | .TP |
221 | 224 | \fBhstr --show-blacklist\fR |
222 | 225 | Show blacklist configured for history processing. |
226 | .TP | |
227 | \fBhstr --insert-in-terminal="git add . && git diff --cached"\fR | |
228 | Insert command in terminal prompt and exit. | |
223 | 229 | .SH AUTHOR |
224 | 230 | Written by Martin Dvorak <martin.dvorak@mindforger.com> |
225 | 231 | .SH BUGS |
1 | 1 | <!-- |
2 | 2 | pad.xml PAD file for HSTR |
3 | 3 | |
4 | Copyright (C) 2014-2020 Martin Dvorak <martin.dvorak@mindforger.com> | |
4 | Copyright (C) 2014-2021 Martin Dvorak <martin.dvorak@mindforger.com> | |
5 | 5 | |
6 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); |
7 | 7 | you may not use this file except in compliance with the License. |
50 | 50 | </Company_Info> |
51 | 51 | <Program_Info> |
52 | 52 | <Program_Name>HSTR</Program_Name> |
53 | <Program_Version>2.3.0</Program_Version> | |
54 | <Program_Release_Month>01</Program_Release_Month> | |
55 | <Program_Release_Day>01</Program_Release_Day> | |
56 | <Program_Release_Year>2020</Program_Release_Year> | |
53 | <Program_Version>2.5.0</Program_Version> | |
54 | <Program_Release_Month>12</Program_Release_Month> | |
55 | <Program_Release_Day>13</Program_Release_Day> | |
56 | <Program_Release_Year>2021</Program_Release_Year> | |
57 | 57 | <Program_Cost_Dollars /> |
58 | 58 | <Program_Cost_Other_Code>USD</Program_Cost_Other_Code> |
59 | 59 | <Program_Cost_Other /> |
0 | 0 | # snapcraft.yaml snap builder configuration |
1 | 1 | # |
2 | # Copyright (C) 2014-2020 Martin Dvorak <martin.dvorak@mindforger.com> | |
2 | # Copyright (C) 2014-2021 Martin Dvorak <martin.dvorak@mindforger.com> | |
3 | 3 | # |
4 | 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
5 | 5 | # you may not use this file except in compliance with the License. |
0 | 0 | /* |
1 | 1 | hashset.c hash set implementation |
2 | 2 | |
3 | Copyright (C) 2014-2020 Martin Dvorak <martin.dvorak@mindforger.com> | |
3 | Copyright (C) 2014-2021 Martin Dvorak <martin.dvorak@mindforger.com> | |
4 | 4 | |
5 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); |
6 | 6 | you may not use this file except in compliance with the License. |
0 | 0 | /* |
1 | 1 | hstr.c HSTR shell history completion utility |
2 | 2 | |
3 | Copyright (C) 2014-2020 Martin Dvorak <martin.dvorak@mindforger.com> | |
3 | Copyright (C) 2014-2021 Martin Dvorak <martin.dvorak@mindforger.com> | |
4 | 4 | |
5 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); |
6 | 6 | you may not use this file except in compliance with the License. |
136 | 136 | |
137 | 137 | // major.minor.revision |
138 | 138 | static const char* VERSION_STRING= |
139 | "hstr version \"2.3.0\" (2020-11-19T07:41:00)" | |
139 | "hstr version \"2.5.0\" (2021-12-13T22:00:00)" | |
140 | 140 | "\n"; |
141 | 141 | |
142 | 142 | static const char* HSTR_VIEW_LABELS[]={ |
262 | 262 | "\n --show-configuration -s ... show configuration to be added to ~/.bashrc" |
263 | 263 | "\n --show-zsh-configuration -z ... show zsh configuration to be added to ~/.zshrc" |
264 | 264 | "\n --show-blacklist -b ... show commands to skip on history indexation" |
265 | "\n --insert-in-terminal=[c] -i ... insert command c in terminal prompt and exit" | |
265 | 266 | "\n --version -V ... show version details" |
266 | 267 | "\n --help -h ... help" |
267 | 268 | "\n" |
278 | 279 | #define GETOPT_OPTIONAL_ARGUMENT 2 |
279 | 280 | |
280 | 281 | static const struct option long_options[] = { |
281 | {"favorites", GETOPT_NO_ARGUMENT, NULL, 'f'}, | |
282 | {"kill-last-command", GETOPT_NO_ARGUMENT, NULL, 'k'}, | |
283 | {"version", GETOPT_NO_ARGUMENT, NULL, 'V'}, | |
284 | {"help", GETOPT_NO_ARGUMENT, NULL, 'h'}, | |
285 | {"non-interactive", GETOPT_NO_ARGUMENT, NULL, 'n'}, | |
286 | {"show-configuration", GETOPT_NO_ARGUMENT, NULL, 's'}, | |
287 | {"show-zsh-configuration", GETOPT_NO_ARGUMENT, NULL, 'z'}, | |
288 | {"show-blacklist", GETOPT_NO_ARGUMENT, NULL, 'b'}, | |
289 | {0, 0, NULL, 0 } | |
282 | {"favorites", GETOPT_NO_ARGUMENT, NULL, 'f'}, | |
283 | {"kill-last-command", GETOPT_NO_ARGUMENT, NULL, 'k'}, | |
284 | {"version", GETOPT_NO_ARGUMENT, NULL, 'V'}, | |
285 | {"help", GETOPT_NO_ARGUMENT, NULL, 'h'}, | |
286 | {"non-interactive", GETOPT_NO_ARGUMENT, NULL, 'n'}, | |
287 | {"show-configuration", GETOPT_NO_ARGUMENT, NULL, 's'}, | |
288 | {"show-zsh-configuration", GETOPT_NO_ARGUMENT, NULL, 'z'}, | |
289 | {"show-blacklist", GETOPT_NO_ARGUMENT, NULL, 'b'}, | |
290 | {"insert-in-terminal", GETOPT_REQUIRED_ARGUMENT, NULL, 'i'}, | |
291 | {0, 0, NULL, 0 } | |
290 | 292 | }; |
291 | 293 | |
292 | 294 | typedef struct { |
739 | 741 | color_attr_on(COLOR_PAIR(HSTR_COLOR_INFO)); |
740 | 742 | color_attr_on(A_BOLD); |
741 | 743 | } |
742 | mvprintw(hstr->promptYNotification, 0, screenLine); | |
744 | mvprintw(hstr->promptYNotification, 0, "%s", screenLine); | |
743 | 745 | if(hstr->theme & HSTR_THEME_COLOR) { |
744 | 746 | color_attr_off(A_BOLD); |
745 | 747 | color_attr_on(COLOR_PAIR(HSTR_COLOR_NORMAL)); |
1667 | 1669 | void hstr_getopt(int argc, char **argv) |
1668 | 1670 | { |
1669 | 1671 | int option_index = 0; |
1670 | int option = getopt_long(argc, argv, "fkVhnszb", long_options, &option_index); | |
1672 | int option = getopt_long(argc, argv, "fkVhnszbi", long_options, &option_index); | |
1671 | 1673 | if(option != -1) { |
1672 | 1674 | switch(option) { |
1673 | 1675 | case 'f': |
1689 | 1691 | blacklist_dump(&hstr->blacklist); |
1690 | 1692 | hstr_exit(EXIT_SUCCESS); |
1691 | 1693 | break; |
1694 | case 'i': | |
1695 | fill_terminal_input(optarg, FALSE); | |
1696 | hstr_exit(EXIT_SUCCESS); | |
1697 | break; | |
1692 | 1698 | case 'V': |
1693 | 1699 | printf("%s", VERSION_STRING); |
1694 | 1700 | hstr_exit(EXIT_SUCCESS); |
0 | 0 | /* |
1 | 1 | hstr_blacklist.c commands to be skipped from history |
2 | 2 | |
3 | Copyright (C) 2014-2020 Martin Dvorak <martin.dvorak@mindforger.com> | |
3 | Copyright (C) 2014-2021 Martin Dvorak <martin.dvorak@mindforger.com> | |
4 | 4 | |
5 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); |
6 | 6 | you may not use this file except in compliance with the License. |
73 | 73 | fileContent[fileSize] = 0; |
74 | 74 | |
75 | 75 | if(fileContent && strlen(fileContent)) { |
76 | char *p=strchr(fileContent,'\n'); | |
77 | while (p!=NULL) { | |
78 | p=strchr(p+1,'\n'); | |
79 | } | |
80 | char *pb=fileContent, *pe, *s; | |
76 | char *pb=fileContent, *pe; | |
81 | 77 | pe=strchr(fileContent, '\n'); |
82 | 78 | while(pe!=NULL) { |
83 | 79 | *pe=0; |
84 | 80 | if(!hashset_contains(blacklist->set,pb)) { |
85 | s=hstr_strdup(pb); | |
86 | hashset_add(blacklist->set,s); | |
81 | hashset_add(blacklist->set,pb); | |
87 | 82 | } |
88 | 83 | pb=pe+1; |
89 | 84 | pe=strchr(pb, '\n'); |
150 | 145 | exit(EXIT_FAILURE); |
151 | 146 | } |
152 | 147 | } |
148 | free(keys[i]); | |
153 | 149 | } |
154 | 150 | fclose(outputFile); |
151 | free(keys); | |
155 | 152 | } else { |
156 | 153 | if(access(fileName, F_OK) != -1) { |
157 | 154 | FILE *outputFile = fopen(fileName, "wb"); |
1 | 1 | hstr_curses.c Curses utilities |
2 | 2 | http://pueblo.sourceforge.net/doc/manual/ansi_color_codes.html |
3 | 3 | |
4 | Copyright (C) 2014-2020 Martin Dvorak <martin.dvorak@mindforger.com> | |
4 | Copyright (C) 2014-2021 Martin Dvorak <martin.dvorak@mindforger.com> | |
5 | 5 | |
6 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); |
7 | 7 | you may not use this file except in compliance with the License. |
0 | 0 | /* |
1 | 1 | hstr_favorites.c favorite commands |
2 | 2 | |
3 | Copyright (C) 2014-2020 Martin Dvorak <martin.dvorak@mindforger.com> | |
3 | Copyright (C) 2014-2021 Martin Dvorak <martin.dvorak@mindforger.com> | |
4 | 4 | |
5 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); |
6 | 6 | you may not use this file except in compliance with the License. |
0 | 0 | /* |
1 | 1 | hstr_history.c loading and processing of BASH history |
2 | 2 | |
3 | Copyright (C) 2014-2020 Martin Dvorak <martin.dvorak@mindforger.com> | |
3 | Copyright (C) 2014-2021 Martin Dvorak <martin.dvorak@mindforger.com> | |
4 | 4 | |
5 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); |
6 | 6 | you may not use this file except in compliance with the License. |
100 | 100 | |
101 | 101 | char* parse_history_line(char *l) |
102 | 102 | { |
103 | #ifndef HSTR_TESTS_UNIT | |
104 | static bool isZsh, c; | |
105 | if(!c) { | |
106 | isZsh=isZshParentShell(); | |
107 | c=true; | |
108 | } | |
109 | #endif | |
110 | ||
103 | 111 | if( |
104 | 112 | #ifndef HSTR_TESTS_UNIT |
105 | !isZshParentShell() || | |
113 | !isZsh || | |
106 | 114 | #endif |
107 | 115 | !l || |
108 | 116 | l[0]!=':') { |
125 | 133 | if(*pt==';') |
126 | 134 | return ++pt; |
127 | 135 | } |
136 | } | |
137 | ||
138 | if (isZsh) { | |
139 | l = zsh_unmetafy(l, NULL); | |
128 | 140 | } |
129 | 141 | |
130 | 142 | return l; |
389 | 401 | |
390 | 402 | void history_mgmt_flush(void) |
391 | 403 | { |
392 | if(dirty) { | |
404 | if(dirty && !isZshParentShell()) { | |
393 | 405 | fill_terminal_input("history -r\n", false); |
394 | 406 | } |
395 | 407 | } |
0 | 0 | /* |
1 | 1 | hstr_regexp.c simplified regexp that suits HSTR needs - matching and caching |
2 | 2 | |
3 | Copyright (C) 2014-2020 Martin Dvorak <martin.dvorak@mindforger.com> | |
3 | Copyright (C) 2014-2021 Martin Dvorak <martin.dvorak@mindforger.com> | |
4 | 4 | |
5 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); |
6 | 6 | you may not use this file except in compliance with the License. |
0 | 0 | /* |
1 | 1 | hstr_utils.c utilities |
2 | 2 | |
3 | Copyright (C) 2014-2020 Martin Dvorak <martin.dvorak@mindforger.com> | |
3 | Copyright (C) 2014-2021 Martin Dvorak <martin.dvorak@mindforger.com> | |
4 | 4 | |
5 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); |
6 | 6 | you may not use this file except in compliance with the License. |
233 | 233 | free(cmdline); |
234 | 234 | return result; |
235 | 235 | } |
236 | ||
237 | /* See zsh utils.c https://github.com/zsh-users/zsh/blob/master/Src/utils.c#L4922 */ | |
238 | char* zsh_unmetafy(char* s, int* len) | |
239 | { | |
240 | char *p, *t; | |
241 | ||
242 | for (p = s; *p && *p != ZSH_META; p++); | |
243 | for (t = p; (*t = *p++);) | |
244 | if (*t++ == ZSH_META) | |
245 | t[-1] = *p++ ^ 32; | |
246 | if (len) | |
247 | *len = t - s; | |
248 | ||
249 | return s; | |
250 | } |
0 | 0 | /* |
1 | 1 | hashset.h header file for hash set |
2 | 2 | |
3 | Copyright (C) 2014-2020 Martin Dvorak <martin.dvorak@mindforger.com> | |
3 | Copyright (C) 2014-2021 Martin Dvorak <martin.dvorak@mindforger.com> | |
4 | 4 | |
5 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); |
6 | 6 | you may not use this file except in compliance with the License. |
0 | 0 | /* |
1 | 1 | hstr.h header file for HSTR shell history completion utility |
2 | 2 | |
3 | Copyright (C) 2014-2020 Martin Dvorak <martin.dvorak@mindforger.com> | |
3 | Copyright (C) 2014-2021 Martin Dvorak <martin.dvorak@mindforger.com> | |
4 | 4 | |
5 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); |
6 | 6 | you may not use this file except in compliance with the License. |
0 | 0 | /* |
1 | 1 | hstr_blacklist.h header file for commands to be skipped from history |
2 | 2 | |
3 | Copyright (C) 2014-2020 Martin Dvorak <martin.dvorak@mindforger.com> | |
3 | Copyright (C) 2014-2021 Martin Dvorak <martin.dvorak@mindforger.com> | |
4 | 4 | |
5 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); |
6 | 6 | you may not use this file except in compliance with the License. |
0 | 0 | /* |
1 | 1 | hstr_curses.h header file for curses helpers |
2 | 2 | |
3 | Copyright (C) 2014-2020 Martin Dvorak <martin.dvorak@mindforger.com> | |
3 | Copyright (C) 2014-2021 Martin Dvorak <martin.dvorak@mindforger.com> | |
4 | 4 | |
5 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); |
6 | 6 | you may not use this file except in compliance with the License. |
0 | 0 | /* |
1 | 1 | hstr_favorites.h header file for favorite commands |
2 | 2 | |
3 | Copyright (C) 2014-2020 Martin Dvorak <martin.dvorak@mindforger.com> | |
3 | Copyright (C) 2014-2021 Martin Dvorak <martin.dvorak@mindforger.com> | |
4 | 4 | |
5 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); |
6 | 6 | you may not use this file except in compliance with the License. |
0 | 0 | /* |
1 | 1 | hstr_history.h header file for loading and processing of BASH history |
2 | 2 | |
3 | Copyright (C) 2014-2020 Martin Dvorak <martin.dvorak@mindforger.com> | |
3 | Copyright (C) 2014-2021 Martin Dvorak <martin.dvorak@mindforger.com> | |
4 | 4 | |
5 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); |
6 | 6 | you may not use this file except in compliance with the License. |
0 | 0 | /* |
1 | 1 | hstr_regexp.h header file for simplified regexp that suits HSTR needs |
2 | 2 | |
3 | Copyright (C) 2014-2020 Martin Dvorak <martin.dvorak@mindforger.com> | |
3 | Copyright (C) 2014-2021 Martin Dvorak <martin.dvorak@mindforger.com> | |
4 | 4 | |
5 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); |
6 | 6 | you may not use this file except in compliance with the License. |
0 | 0 | /* |
1 | 1 | hstr_utils.h header file for HSTR utilities |
2 | 2 | |
3 | Copyright (C) 2014-2020 Martin Dvorak <martin.dvorak@mindforger.com> | |
3 | Copyright (C) 2014-2021 Martin Dvorak <martin.dvorak@mindforger.com> | |
4 | 4 | |
5 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); |
6 | 6 | you may not use this file except in compliance with the License. |
30 | 30 | #define ENV_VAR_HOME "HOME" |
31 | 31 | |
32 | 32 | #define UNUSED_ARG(expr) do { (void)(expr); } while (0) |
33 | #define ZSH_META ((char) 0x83) | |
33 | 34 | |
34 | 35 | #define MIN(a,b) (((a)<(b))?(a):(b)) |
35 | 36 | #define MAX(a,b) (((a)>(b))?(a):(b)) |
47 | 48 | char* get_home_file_path(char* filename); |
48 | 49 | void toggle_case(char* str, bool lowercase); |
49 | 50 | bool isZshParentShell(void); |
51 | char* zsh_unmetafy(char* s, int* len); | |
50 | 52 | |
51 | 53 | #endif |
0 | 0 | /* |
1 | 1 | radixsort.h header file for radix sort implementation |
2 | 2 | |
3 | Copyright (C) 2014-2020 Martin Dvorak <martin.dvorak@mindforger.com> | |
3 | Copyright (C) 2014-2021 Martin Dvorak <martin.dvorak@mindforger.com> | |
4 | 4 | |
5 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); |
6 | 6 | you may not use this file except in compliance with the License. |
0 | 0 | /* |
1 | 1 | main.c HSTR shell history completion utility main |
2 | 2 | |
3 | Copyright (C) 2014-2020 Martin Dvorak <martin.dvorak@mindforger.com> | |
3 | Copyright (C) 2014-2021 Martin Dvorak <martin.dvorak@mindforger.com> | |
4 | 4 | |
5 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); |
6 | 6 | you may not use this file except in compliance with the License. |
0 | 0 | /* |
1 | 1 | radixsort.c radix sort |
2 | 2 | |
3 | Copyright (C) 2014-2020 Martin Dvorak <martin.dvorak@mindforger.com> | |
3 | Copyright (C) 2014-2021 Martin Dvorak <martin.dvorak@mindforger.com> | |
4 | 4 | |
5 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); |
6 | 6 | you may not use this file except in compliance with the License. |
0 | 0 | # hstr-unit-tests.pro Qt project file of UNIT tests for HSTR |
1 | 1 | # |
2 | # Copyright (C) 2014-2020 Martin Dvorak <martin.dvorak@mindforger.com> | |
2 | # Copyright (C) 2014-2021 Martin Dvorak <martin.dvorak@mindforger.com> | |
3 | 3 | # |
4 | 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
5 | 5 | # you may not use this file except in compliance with the License. |
0 | 0 | /* |
1 | 1 | test.c UNIT tests main for HSTR shell history completion utility |
2 | 2 | |
3 | Copyright (C) 2014-2020 Martin Dvorak <martin.dvorak@mindforger.com> | |
3 | Copyright (C) 2014-2021 Martin Dvorak <martin.dvorak@mindforger.com> | |
4 | 4 | |
5 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); |
6 | 6 | you may not use this file except in compliance with the License. |
0 | 0 | /* |
1 | 1 | test_*.c HSTR test |
2 | 2 | |
3 | Copyright (C) 2014-2020 Martin Dvorak <martin.dvorak@mindforger.com> | |
3 | Copyright (C) 2014-2021 Martin Dvorak <martin.dvorak@mindforger.com> | |
4 | 4 | |
5 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); |
6 | 6 | you may not use this file except in compliance with the License. |
0 | 0 | /* |
1 | 1 | test_*.c HSTR test |
2 | 2 | |
3 | Copyright (C) 2014-2020 Martin Dvorak <martin.dvorak@mindforger.com> | |
3 | Copyright (C) 2014-2021 Martin Dvorak <martin.dvorak@mindforger.com> | |
4 | 4 | |
5 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); |
6 | 6 | you may not use this file except in compliance with the License. |
0 | 0 | /* |
1 | 1 | test_*.c HSTR test |
2 | 2 | |
3 | Copyright (C) 2014-2020 Martin Dvorak <martin.dvorak@mindforger.com> | |
3 | Copyright (C) 2014-2021 Martin Dvorak <martin.dvorak@mindforger.com> | |
4 | 4 | |
5 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); |
6 | 6 | you may not use this file except in compliance with the License. |
0 | 0 | /* |
1 | 1 | test_*.c HSTR test |
2 | 2 | |
3 | Copyright (C) 2014-2020 Martin Dvorak <martin.dvorak@mindforger.com> | |
3 | Copyright (C) 2014-2021 Martin Dvorak <martin.dvorak@mindforger.com> | |
4 | 4 | |
5 | 5 | Licensed under the Apache License, Version 2.0 (the "License"); |
6 | 6 | you may not use this file except in compliance with the License. |
0 | 0 | #!/bin/bash |
1 | 1 | # |
2 | # Copyright (C) 2014-2020 Martin Dvorak <martin.dvorak@mindforger.com> | |
2 | # Copyright (C) 2014-2021 Martin Dvorak <martin.dvorak@mindforger.com> | |
3 | 3 | # |
4 | 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
5 | 5 | # you may not use this file except in compliance with the License. |
0 | 0 | #!/bin/bash |
1 | 1 | # |
2 | # Copyright (C) 2014-2020 Martin Dvorak <martin.dvorak@mindforger.com> | |
2 | # Copyright (C) 2014-2021 Martin Dvorak <martin.dvorak@mindforger.com> | |
3 | 3 | # |
4 | 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
5 | 5 | # you may not use this file except in compliance with the License. |
0 | 0 | #!/bin/bash |
1 | 1 | # |
2 | # Copyright (C) 2014-2020 Martin Dvorak <martin.dvorak@mindforger.com> | |
2 | # Copyright (C) 2014-2021 Martin Dvorak <martin.dvorak@mindforger.com> | |
3 | 3 | # |
4 | 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
5 | 5 | # you may not use this file except in compliance with the License. |
0 | 0 | #!/bin/bash |
1 | 1 | # |
2 | # Copyright (C) 2014-2020 Martin Dvorak <martin.dvorak@mindforger.com> | |
2 | # Copyright (C) 2014-2021 Martin Dvorak <martin.dvorak@mindforger.com> | |
3 | 3 | # |
4 | 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
5 | 5 | # you may not use this file except in compliance with the License. |
0 | 0 | #!/bin/bash |
1 | 1 | # |
2 | # Copyright (C) 2014-2020 Martin Dvorak <martin.dvorak@mindforger.com> | |
2 | # Copyright (C) 2014-2021 Martin Dvorak <martin.dvorak@mindforger.com> | |
3 | 3 | # |
4 | 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
5 | 5 | # you may not use this file except in compliance with the License. |
0 | 0 | #!/bin/bash |
1 | 1 | # |
2 | # Copyright (C) 2014-2020 Martin Dvorak <martin.dvorak@mindforger.com> | |
2 | # Copyright (C) 2014-2021 Martin Dvorak <martin.dvorak@mindforger.com> | |
3 | 3 | # |
4 | 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
5 | 5 | # you may not use this file except in compliance with the License. |
0 | 0 | #!/bin/bash |
1 | 1 | # |
2 | # Copyright (C) 2014-2020 Martin Dvorak <martin.dvorak@mindforger.com> | |
2 | # Copyright (C) 2014-2021 Martin Dvorak <martin.dvorak@mindforger.com> | |
3 | 3 | # |
4 | 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
5 | 5 | # you may not use this file except in compliance with the License. |
0 | 0 | #!/bin/bash |
1 | 1 | # |
2 | # Copyright (C) 2014-2020 Martin Dvorak <martin.dvorak@mindforger.com> | |
2 | # Copyright (C) 2014-2021 Martin Dvorak <martin.dvorak@mindforger.com> | |
3 | 3 | # |
4 | 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
5 | 5 | # you may not use this file except in compliance with the License. |
0 | 0 | #!/bin/bash |
1 | 1 | # |
2 | # Copyright (C) 2014-2020 Martin Dvorak <martin.dvorak@mindforger.com> | |
2 | # Copyright (C) 2014-2021 Martin Dvorak <martin.dvorak@mindforger.com> | |
3 | 3 | # |
4 | 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
5 | 5 | # you may not use this file except in compliance with the License. |