Giter Site home page Giter Site logo

peep's People

Contributors

mic92 avatar moredread avatar ryochack 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

peep's Issues

Feature: Support clearing peep output on exit

By default, when less exits, the text it was displaying is cleared and the user's terminal window is returned to the state it was in prior to less being invoked.

I think this is a vital feature of less, and of short-lived interactive CLI utilities in general (programs like fzf, bat, etc. also implement this feature).

Peep's selling point seems to be its focus on not displacing the surrounding terminal context; I think that the functionality I just described would be very complementary to this focus.

As a workaround, I wrote a little wrapper script which basically accomplishes this (requires ncurses):

#!/bin/bash
set -euo pipefail

function isset_help() {
  local opt
  for opt in "$@"; do
    case "$opt" in
      --)
        echo 0
        return 0
        ;;
      --help)
        echo 1
        return 0
        ;;
    esac
  done

  while getopts ':h' opt "$@"; do
    case "$opt" in
      h)
        echo 1
        return 0
        ;;
      *)
        continue
        ;;
    esac
  done

  echo 0
  return 0
}

function main() {
  local -i h
  h=$(isset_help "$@")
  [[ $h -eq 0 ]] && tput sc
  peep "$@"
  local -i c=$?
  [[ $c -eq 0 && $h -eq 0 ]] && tput rc
  return $c
}

main "$@"

Before:

2021-01-12_23-43-44_Alacritty.mp4

After:

2021-01-12_23-47-02_Alacritty.mp4

It's far from ideal and doesn't work when the cursor line is at or within --lines of the bottom of the terminal window, but it should give you an idea of what I am proposing.

Thanks for creating this project, I really love using it!

Support raw output mode

The output of peep contains escape sequences.
This is a problem when using pipe or redirect.

$ cargo run -- -n 4 Cargo.toml > out.txt
$ vim out.txt
�[1G�[2K
lines�[2K
lines�[2K
lines�[2K
lines�[2K�[4F [package]�[m
 name = "peep"�[m
 edition = "2018"�[m
 version = "0.1.4"�[m

So, I will add raw-output-mode to peep to fix it.

Support ansi color codes

If you could implement the support of ansi color coding that would be fantastic. Right now if I use color codes, they get printed literally:

echo -e "\x1b[38;5;208mTEST" | peep

Output:
[38;5;208mTEST

Thank you so much

Fix Inappropriate ioctl for device

標準アウトプットはTTYじゃないとき、パニックしてしまいます。もっとましなエラーメッセージがでたらいいなと思います。なお、TTYじゃない場合は初期設定のサイズのウィンドウで出力を出して終了するのもありかなと思ったりしますが、いかがでしょうか。

peep Hello.txt | cat
thread 'main' panicked at 'terminal_size get error: Os { code: 25, kind: Other, message: "Inappropriate ioctl for device" }', src/libcore/result.rs:999:5
stack backtrace:
   0: std::panicking::default_hook::{{closure}}
   1: std::panicking::default_hook
   2: std::panicking::rust_panic_with_hook
   3: std::panicking::continue_panic_fmt
   4: rust_begin_unwind
   5: core::panicking::panic_fmt
   6: core::result::unwrap_failed
   7: peep::pane::Pane::new
   8: peep::app::App::run
   9: peep::main
  10: std::rt::lang_start::{{closure}}
  11: std::panicking::try::do_call
  12: __rust_maybe_catch_panic
  13: std::rt::lang_start_internal
  14: main

Support moving with arrows, PageUp, PageDown, …

Could you please consider adding the following alternative key bindings?

DownArrow   Scroll down
UpArrow     Scroll up
PageDown    Scroll down a page
PageUp      Scroll up a page
RightArrow  Scroll horizontally right
LeftArrow   Scroll horizontally left
Home        Go to the beggining of line
End         Go to the end of line

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.