Skip to content

Commit

Permalink
Adding ability to inject command to terminal.
Browse files Browse the repository at this point in the history
  • Loading branch information
dvorka committed Dec 2, 2021
1 parent 7d984e4 commit 64b96d4
Show file tree
Hide file tree
Showing 64 changed files with 83 additions and 67 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# .travis.yml Travis CI configuration file for HSTR
#
# Copyright (C) 2014-2020 Martin Dvorak <[email protected]>
# Copyright (C) 2014-2021 Martin Dvorak <[email protected]>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
4 changes: 4 additions & 0 deletions Changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
2021-12-03 Martin Dvorak <[email protected]>

* Released v2.4.0 - inject any command to terminal and minor fixes.

2020-11-19 Martin Dvorak <[email protected]>

* Released v2.3.0 - zsh timestamp extended history parsing and SEGFAULT fixes.
Expand Down
2 changes: 1 addition & 1 deletion build/anigif-build.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
#
# Copyright (C) 2014-2020 Martin Dvorak <[email protected]>
# Copyright (C) 2014-2021 Martin Dvorak <[email protected]>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion build/anigif-create.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
#
# Copyright (C) 2014-2020 Martin Dvorak <[email protected]>
# Copyright (C) 2014-2021 Martin Dvorak <[email protected]>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion build/anigif-rename.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
#
# Copyright (C) 2014-2020 Martin Dvorak <[email protected]>
# Copyright (C) 2014-2021 Martin Dvorak <[email protected]>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion build/arch/update-pkgconfig-sha256-on-repo-change.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
#
# Copyright (C) 2014-2020 Martin Dvorak <[email protected]>
# Copyright (C) 2014-2021 Martin Dvorak <[email protected]>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion build/debian/aptly-add-deb.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
#
# Copyright (C) 2016-2020 Martin Dvorak <[email protected]>
# Copyright (C) 2016-2021 Martin Dvorak <[email protected]>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
Expand Down
2 changes: 1 addition & 1 deletion build/debian/make-deb.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
#
# Copyright (C) 2014-2020 Martin Dvorak <[email protected]>
# Copyright (C) 2014-2021 Martin Dvorak <[email protected]>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion build/debian/upload-to-mentors.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
#
# Copyright (C) 2014-2020 Martin Dvorak <[email protected]>
# Copyright (C) 2014-2021 Martin Dvorak <[email protected]>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion build/fedora/rpm-from-deb.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
#
# Copyright (C) 2014-2020 Martin Dvorak <[email protected]>
# Copyright (C) 2014-2021 Martin Dvorak <[email protected]>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
Expand Down
2 changes: 1 addition & 1 deletion build/tarball/tarball-automake.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
#
# Copyright (C) 2014-2020 Martin Dvorak <[email protected]>
# Copyright (C) 2014-2021 Martin Dvorak <[email protected]>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion build/tarball/tarball-build.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
#
# Copyright (C) 2014-2020 Martin Dvorak <[email protected]>
# Copyright (C) 2014-2021 Martin Dvorak <[email protected]>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion build/tarball/tarball-uninstall.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
#
# Copyright (C) 2014-2020 Martin Dvorak <[email protected]>
# Copyright (C) 2014-2021 Martin Dvorak <[email protected]>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion build/test-clean.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
#
# Copyright (C) 2014-2020 Martin Dvorak <[email protected]>
# Copyright (C) 2014-2021 Martin Dvorak <[email protected]>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion build/test-gdb.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
#
# Copyright (C) 2014-2020 Martin Dvorak <[email protected]>
# Copyright (C) 2014-2021 Martin Dvorak <[email protected]>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion build/test-generate-unity-test-runner.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
#
# Copyright (C) 2014-2020 Martin Dvorak <[email protected]>
# Copyright (C) 2014-2021 Martin Dvorak <[email protected]>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion build/test-memleaks.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
#
# Copyright (C) 2014-2020 Martin Dvorak <[email protected]>
# Copyright (C) 2014-2021 Martin Dvorak <[email protected]>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion build/test-set-env-monster-history.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
#
# Copyright (C) 2014-2020 Martin Dvorak <[email protected]>
# Copyright (C) 2014-2021 Martin Dvorak <[email protected]>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion build/test-set-env-utf8-history.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
#
# Copyright (C) 2014-2020 Martin Dvorak <[email protected]>
# Copyright (C) 2014-2021 Martin Dvorak <[email protected]>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion build/test-units.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
#
# Copyright (C) 2014-2020 Martin Dvorak <[email protected]>
# Copyright (C) 2014-2021 Martin Dvorak <[email protected]>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion build/ubuntu/launchpad-add-hstr-ppa.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
#
# Copyright (C) 2014-2020 Martin Dvorak <[email protected]>
# Copyright (C) 2014-2021 Martin Dvorak <[email protected]>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion build/ubuntu/launchpad-make-all-releases.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
#
# Copyright (C) 2014-2020 Martin Dvorak <[email protected]>
# Copyright (C) 2014-2021 Martin Dvorak <[email protected]>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion build/ubuntu/pbuilder-add-new-distro.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
#
# Copyright (C) 2014-2020 Martin Dvorak <[email protected]>
# Copyright (C) 2014-2021 Martin Dvorak <[email protected]>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion build/ubuntu/pbuilder-refresh-all-distros.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
#
# Copyright (C) 2014-2020 Martin Dvorak <[email protected]>
# Copyright (C) 2014-2021 Martin Dvorak <[email protected]>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# configure.ac Autoconf configuration file
#
# Copyright (C) 2014-2020 Martin Dvorak <[email protected]>
# Copyright (C) 2014-2021 Martin Dvorak <[email protected]>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion etc/bash-completion.d/hstr
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
#
# Copyright (C) 2014-2020 Martin Dvorak <[email protected]>
# Copyright (C) 2014-2021 Martin Dvorak <[email protected]>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion hstr.pro
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# hstr.pro Qt project file for HSTR shell history compleation utility
#
# Copyright (C) 2014-2020 Martin Dvorak <[email protected]>
# Copyright (C) 2014-2021 Martin Dvorak <[email protected]>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
6 changes: 6 additions & 0 deletions man/hstr.1
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ Print filtered history on standard output and exit
.TP
\fB-k --kill-last-command\fR
Delete the last command from history and exit
.TP
\fB-i --inject-in-terminal=[command]\fR
Inject command to terminal and exit
.TP
\fB-f --favorites\fR
Show favorites view immediately
Expand Down Expand Up @@ -221,6 +224,9 @@ bindkey -s "\eC\-r" "\eC\-a hstr \-\- \eC\-j" # bind hstr to Ctrl-r (for Vi mode
.TP
\fBhstr --show-blacklist\fR
Show blacklist configured for history processing.
.TP
\fBhstr --inject-in-terminal="git add . && git diff --cached"\fR
Insert command in terminal and exit.
.SH AUTHOR
Written by Martin Dvorak <[email protected]>
.SH BUGS
Expand Down
10 changes: 5 additions & 5 deletions pad.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<!--
pad.xml PAD file for HSTR
Copyright (C) 2014-2020 Martin Dvorak <[email protected]>
Copyright (C) 2014-2021 Martin Dvorak <[email protected]>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -51,10 +51,10 @@
</Company_Info>
<Program_Info>
<Program_Name>HSTR</Program_Name>
<Program_Version>2.3.0</Program_Version>
<Program_Release_Month>01</Program_Release_Month>
<Program_Release_Day>01</Program_Release_Day>
<Program_Release_Year>2020</Program_Release_Year>
<Program_Version>2.4.0</Program_Version>
<Program_Release_Month>12</Program_Release_Month>
<Program_Release_Day>3</Program_Release_Day>
<Program_Release_Year>2021</Program_Release_Year>
<Program_Cost_Dollars />
<Program_Cost_Other_Code>USD</Program_Cost_Other_Code>
<Program_Cost_Other />
Expand Down
2 changes: 1 addition & 1 deletion snap/snapcraft.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# snapcraft.yaml snap builder configuration
#
# Copyright (C) 2014-2020 Martin Dvorak <[email protected]>
# Copyright (C) 2014-2021 Martin Dvorak <[email protected]>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion src/hashset.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
hashset.c hash set implementation
Copyright (C) 2014-2020 Martin Dvorak <[email protected]>
Copyright (C) 2014-2021 Martin Dvorak <[email protected]>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
10 changes: 8 additions & 2 deletions src/hstr.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
hstr.c HSTR shell history completion utility
Copyright (C) 2014-2020 Martin Dvorak <[email protected]>
Copyright (C) 2014-2021 Martin Dvorak <[email protected]>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -263,6 +263,7 @@ static const char* HELP_STRING=
"\n --show-configuration -s ... show configuration to be added to ~/.bashrc"
"\n --show-zsh-configuration -z ... show zsh configuration to be added to ~/.zshrc"
"\n --show-blacklist -b ... show commands to skip on history indexation"
"\n --inject-in-terminal=[c] -i ... inject command c in terminal and exit"
"\n --version -V ... show version details"
"\n --help -h ... help"
"\n"
Expand All @@ -287,6 +288,7 @@ static const struct option long_options[] = {
{"show-configuration", GETOPT_NO_ARGUMENT, NULL, 's'},
{"show-zsh-configuration", GETOPT_NO_ARGUMENT, NULL, 'z'},
{"show-blacklist", GETOPT_NO_ARGUMENT, NULL, 'b'},
{"inject-in-terminal", GETOPT_OPTIONAL_ARGUMENT, NULL, 'i'},
{0, 0, NULL, 0 }
};

Expand Down Expand Up @@ -1668,7 +1670,7 @@ void hstr_interactive(void)
void hstr_getopt(int argc, char **argv)
{
int option_index = 0;
int option = getopt_long(argc, argv, "fkVhnszb", long_options, &option_index);
int option = getopt_long(argc, argv, "fkVhnszbi", long_options, &option_index);
if(option != -1) {
switch(option) {
case 'f':
Expand All @@ -1690,6 +1692,10 @@ void hstr_getopt(int argc, char **argv)
blacklist_dump(&hstr->blacklist);
hstr_exit(EXIT_SUCCESS);
break;
case 'i':
fill_terminal_input(optarg, FALSE);
hstr_exit(EXIT_SUCCESS);
break;
case 'V':
printf("%s", VERSION_STRING);
hstr_exit(EXIT_SUCCESS);
Expand Down
2 changes: 1 addition & 1 deletion src/hstr_blacklist.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
hstr_blacklist.c commands to be skipped from history
Copyright (C) 2014-2020 Martin Dvorak <[email protected]>
Copyright (C) 2014-2021 Martin Dvorak <[email protected]>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion src/hstr_curses.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
hstr_curses.c Curses utilities
http://pueblo.sourceforge.net/doc/manual/ansi_color_codes.html
Copyright (C) 2014-2020 Martin Dvorak <[email protected]>
Copyright (C) 2014-2021 Martin Dvorak <[email protected]>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion src/hstr_favorites.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
hstr_favorites.c favorite commands
Copyright (C) 2014-2020 Martin Dvorak <[email protected]>
Copyright (C) 2014-2021 Martin Dvorak <[email protected]>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion src/hstr_history.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
hstr_history.c loading and processing of BASH history
Copyright (C) 2014-2020 Martin Dvorak <[email protected]>
Copyright (C) 2014-2021 Martin Dvorak <[email protected]>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion src/hstr_regexp.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
hstr_regexp.c simplified regexp that suits HSTR needs - matching and caching
Copyright (C) 2014-2020 Martin Dvorak <[email protected]>
Copyright (C) 2014-2021 Martin Dvorak <[email protected]>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion src/hstr_utils.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
hstr_utils.c utilities
Copyright (C) 2014-2020 Martin Dvorak <[email protected]>
Copyright (C) 2014-2021 Martin Dvorak <[email protected]>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion src/include/hashset.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
hashset.h header file for hash set
Copyright (C) 2014-2020 Martin Dvorak <[email protected]>
Copyright (C) 2014-2021 Martin Dvorak <[email protected]>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion src/include/hstr.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
hstr.h header file for HSTR shell history completion utility
Copyright (C) 2014-2020 Martin Dvorak <[email protected]>
Copyright (C) 2014-2021 Martin Dvorak <[email protected]>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
Loading

0 comments on commit 64b96d4

Please sign in to comment.