GithubHelp home page GithubHelp logo

jcsalterego / historian Goto Github PK

View Code? Open in Web Editor NEW
547.0 13.0 27.0 19 KB

Command-line utility for managing shell history in a SQLite database.

License: Other

Shell 98.66% Makefile 1.34%
shell history

historian's People

Contributors

jcsalterego avatar sim4n6 avatar wilfred avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

historian's Issues

Some improvements

hi @jcsalterego nice script you have here, I would like to suggest this :

  • Shell check the script
  • Colorizing echo
  • Getting rid of checking the existence of $HOME
  • Add description for script at the beginning
  • apply best practices

please assign this issue to me, I will PR later

fzf / output format

Hi there,

do you have any idea why historian doesn't work with fzf ?

After installing fzf i simply changed history to hist / in https://github.com/junegunn/fzf/blob/master/shell/key-bindings.bash#L58
and this works when searching in the history by pressing CTRL+R in the terminal. But when selecting one of the items in the list, that item doesn't get output/pasted back to the terminal.

I noticed that the output format of historian is different from the default 'history', so perhaps that is the issue?
If so, it would be cool if the output format would be equal to history, for better compatibility with other tools.

Thank you!

$ history | grep -i 'test 123'
  520  echo "test 123"
$
$ hist /'test 123'
1923
    echo "test 123"
$

Support for zsh

I use zsh. It's fairly simple to support this by making the SRC var settable. Can this be done? If so how would you suggest it, if I were to try do that myself as a PR?

Homebrew Support

Hi,

This looks great. Is it something that could be added to Homebrews repos?

Thanks.

Import truncates commands at a length of 23 characters on Linux

Testing this on linux in the hope that historian will be able maintain the command history intelligently across multiple terminals in bash (depends on #9).

However, at the moment I'm seeing a more fundamental problem - imported commands truncated to 23 characters?

Nice project!

Support for fish

Fish's history includes a little more information than just the command that was executed. ~/.local/share/fish/fish_history is a yaml file, here's a sample:

- cmd: v /usr/local/etc/rethinkdb.conf 
  when: 1492027898
  paths:
    - /usr/local/etc/rethinkdb.conf

As you can see it includes the command, a timestamp, and the filepaths references by the command.

Simplify the call of sqlite from historian

Quick question: please, why you are not using sqlite3 in none interactive mode like this:
#!/bin/bash
sqlite3 test.db "create table n (id INTEGER PRIMARY KEY,f TEXT,l TEXT);"

import for command with backticks

Have you seen this before?

[user@centos7 ~]$ cat .bash_history
echo `whoami`
[user@centos7 ~]$ local/libexec/hist import
Error: /home/user/.bash_history line 1: expected 1 columns of data but found 3
Imported 0 item(s).

unescaped " character

/Users/zivago/.bash_history:18093: unescaped " character
/Users/zivago/.bash_history:18093: unescaped " character
/Users/zivago/.bash_history:18093: unescaped " character
/Users/zivago/.bash_history:18093: unescaped " character
/Users/zivago/.bash_history:18093: unescaped " character
/Users/zivago/.bash_history:18093: unescaped " character
/Users/zivago/.bash_history:18093: unescaped " character
/Users/zivago/.bash_history:18088: unterminated "-quoted field
Imported 1 item(s).

this is on historian v0.0.2. Looks like some of the items in bash history was a bad command line option. Anyway to escape them properly so it imports it?

Import error with unescaped " character

Hello,

when I try to import my history with some lines containing the '"' character it will fail with :

/home/bob/.bash_history:156: unescaped " character
/home/bob/.bash_history:156: unescaped " character
/home/bob/.bash_history:506: unescaped " character

Concerned lines example :

ssh-keygen -f "/home/bob/.ssh/known_hosts" -R

A single quote in .bash_history triggers an error

A single quote " triggers an error

/Users/maxm/.bash_history:3436: unescaped " character
/Users/maxm/.bash_history:3889: unterminated "-quoted field

Seems to depend somewhat on the presence of surrounding quote characters in the bash history

To reproduce, a .bash_history file containing only:


"
hist import

triggers this error

Allow updating on every bash command

$ hist count
183
$ ls /some/new/path
...
$ hist count
184

It would be nice to insert items in the database immediately. This is particularly useful when you have two terminals open.

Historian roadmap

Hi Jerry, you have a wonderful project here. Thank you for sharing the code. I would like to help and participate ....

Could you please set an initial board to suggest fix and add features ?

Regards,

error on import

Got these errors on import:

/Users/user/.bash_history:484: expected 1 columns but found 3 - extras ignored

This line has:

i2cssh -2 -A -l user for i in $(seq -f %02g 1 8); do echo -n "server$i-use1 " ; done

I'm guessing it is having issues on the quotes or backticks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.