Coder Social home page Coder Social logo

curusarn / resh Goto Github PK

View Code? Open in Web Editor NEW
1.0K 9.0 20.0 2.37 MB

RESH ❯❯ Contextual shell history for zsh and bash

License: MIT License

Makefile 1.30% Go 85.18% Shell 13.53%
shell-history bash zsh history productivity linux macos thesis context contextual

resh's Introduction

Latest version Go Report Card Go test Shell test

RESH

Context-based replacement for zsh and bash shell history.

Full-text search your shell history.
Relevant results are displayed first based on current directory, git repo, and exit status.

Install

Install RESH with one command:

curl -fsSL https://raw.githubusercontent.com/curusarn/resh/master/scripts/rawinstall.sh | bash

ℹ️ You will need to have bash, curl, and tar installed.

More options on Installation page ⇗

Search your history

Press Ctrl + R to search:

RESH search app screenshot

In-app key bindings

  • Type to search
  • Up / Down or Ctrl + P / Ctrl + N to select results
  • Enter to execute selected command
  • Right to paste selected command onto the command line so you can edit it before execution
  • Ctrl + C or Ctrl + D to quit
  • Ctrl + G to abort and paste the current query onto the command line
  • Ctrl + R to search without context (toggle)

Issues & ideas

Find help on Troubleshooting page ⇗

Problem persists? Create an issue ⇗

resh's People

Contributors

curusarn avatar jessime avatar miohtama avatar r-darwish avatar sciencentistguy avatar tivvit 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

resh's Issues

Check for updates automatically at the start of the first terminal session

  • Oh-my-zsh does it like this

  • This will lead to higher reliability because daemon is not running yet (no restart needed etc...)

Can we assume: "daemon is not running" => "first session of the day"

This could cause problems -> we should have a ~/.resh/last_update_check.touch AND a checking interval (CheckForUpdatesEveryNDays) in settings.

Add "How to install" to readme

go version 2>/dev/null || echo please install go

if go version >= 1.11: build & install

else:
please install go-dep; then do dep init, build & install

.resh/util.sh: line 64: syntax error in conditional expression: unexpected token `('

It looks like there is a small issue in the final step of the installation on MacOS.

curl -fsSL https://raw.githubusercontent.com/curusarn/resh/master/scripts/rawinstall.sh | bash

Please report any issues you encounter to: https://github.com/curusarn/resh/issues

Looking for the latest release ...
 * Latest version: 2.4.10 (git tag: v2.4.10)

Downloading files ...
 * resh_2.4.10_checksums.txt
######################################################################### 100.0%
 * resh_2.4.10_darwin_amd64.tar.gz
######################################################################### 100.0%

Checking integrity ...
 * OK

Extracting downloaded files ...
 * OK

Checking your system ...
 * Login shell: zsh - OK
 * Bash version: 3.2.57(1)-release - OK
 * Zsh version: 5.7.1 - OK
 * Nohup installed: OK

Creating directories ...
Copying files ...
Generating completions ...
Copying more files ...
Finishing up ...
/Users/vit.listik/.resh/util.sh: line 64: syntax error in conditional expression: unexpected token `('

INSTALLATION FAILED!
I'm sorry for the inconvenience.

Please create an issue: https://github.com/curusarn/resh/issues

You can rerun the installation by executing: (this will skip downloading)

cd /tmp/resh-rawinstall-Kwh && scripts/install.sh

RESH INFO: New RESH shellrc script was loaded - if you encounter any issues please restart this terminal session.

Update readme

write about new features, about sanitization, about reshctl

Inspiration for resh cli

This issue serves as a collection of other tools that provide advanced search capabilities and do so in ways that can be used as an inspiration for resh cli.

Resulting design deciosions: #66

remove $WINDOWID

  • is set by xterm, termite, ... ?
  • we don't want to rely on terminal specific stuff
  • I can just generate my own session id

Handle signals

I'm thinking:

  1. trap SIGTERM
  2. go die after a certain timeout
  3. broadcast shutdown request via special shutdown channels
  4. every component:
    1. gets the message
    2. does cleanup
    3. sends back message using the shutdown channel
  5. wait for a message from each component using shutdown channels
  6. die

Add update to reshctl

Updates are currently done by running make install in the cloned repository.

Use reshctl update instead.

No license information

Hey. I wonder if your project is free software. What license is it distributed under?

Usage data sanitization

My idea is to replace sensitive info with placeholders.

It's important to make sure that the same piece of information is always replaced with the same placeholder.

Replace sensitive info with hashes.

bash-preexec and `bind -x` widgets don't like each other

bind -x causes bash-preexec to run when it's not supposed to.

I added some nasty hack to work around it but I would like to solve it properly.

That said I'm really not sure if it's even possible. Bash is being super difficult to work with.

Tests

  • Zsh compatibility test
  • Installation test

installation doesn't work on macOS

A: You have to add [ -f ~/.bashrc ] && . ~/.bashrc to your ~/.bash_profile.

Long Answer: Under macOS bash shell only loads ~/.bash_profile because every shell runs as login shell. I will definitely work around this in the future but since this doesn't affect many people I decided to not solve this issue at the moment.

check if the history loading works properly, fix deduplication

  • history file gets loaded into histfile
  • histfile appends commands as they are written to history file
  • histsess initializes itself using commands from histfile

In the end sesshist contains a sequence of persisted commands, recent commands, and session commands.

I just hacked it together so I never really checked if it really works as it's supposed to.

Also deduplication doesn't work across the 3 sections mentioned above.

OS X support

GNU vs BSD

  • I tried to avoid GNU specific stuff
  • It should be fine

os release

% sw_vers
ProductName:	Mac OS X
ProductVersion:	10.12.6
BuildVersion:	16G1815
  • use uname to get Linux or Darwin

Old versions of dependencies

What are the oldest versions of our dependencies are being shipped with popular OS's?

OS golang bash zsh
macOS (Mojave) N/A 3.2.57 5.3
macOS (Catalina) N/A 3.2.57 5.7.1
Ubuntu LTS 16.04 (Xenial) 1.6.2 (1.10 via backports) 4.3 5.1.1
Ubuntu LTS 18.04 (Bionic) 1.10.1 4.4 5.4.2
Debian Stretch (oldstable) 1.7.4 4.4 5.3.1
Debian Buster (stable) 1.11.6 5.0 5.7.1

Oldest golang: 1.10 (Xenial)
Oldest bash: 3.2.57 (macOS)
Oldest zsh: 5.1.1 (Xenial)

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.