Git Product home page Git Product logo

eg's People

Contributors

ajwalkiewicz avatar bdellaterra avatar brobin avatar dflamand avatar dgm9704 avatar kritts avatar lijingjiang avatar lirt avatar louis-riviere-xyz avatar maclandrol avatar mayanksuman avatar mcarton avatar milouse avatar momeni avatar moyiz avatar nawer avatar scorphus avatar sispheor avatar smmoosavi avatar srsudar avatar tyhawkins avatar vanillajonathan 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

eg's Issues

Formatting is wrong in Msysgit's bash on Windows

Shows like this:

The system cannot find the path specified.
?[30m?[1m#?[0m?[31m?[1m tar?[0m

extract .tar file

    ?[36m?[1m?[0m?[32m?[1mtar vfx archive.tar?[0m


unzip and extract .tar.gz or .tgz file

    ?[36m?[1m?[0m?[32m?[1mtar vfxz g_zipped_archive.tar.gz?[0m


turn directory into a .tar file

    ?[36m?[1m?[0m?[32m?[1mtar vfc tarred_directory.tar directory?[0m


turn directory into g-zipped directory

    ?[36m?[1m?[0m?[32m?[1mtar vfcz z_zipped_directory.tar.gz directory?[0m

No recognize config path: $HOME/.config/eg/egrc

Version: 1.2.0
Installed from pip

I follow the information on README of the repository. For custom config file I create a file called egrc on the next path: skabit/.config/eg, but nothing happens. In this file I only add a custom directory with my examples:

[eg-config]
# Lines starting with # are treated as comments
custom-dir = ~/docu/cheats

compatibility with Python3

In python 3.4 (or any Python3 envs) we got:

Traceback (most recent call last):
  File "/usr/bin/eg", line 3, in <module>
    from eg import eg_exec
  File "/usr/lib/python3.4/site-packages/eg/eg_exec.py", line 74
    print 'you must specify a program or pass the --list or --version flags'
                                                                           ^
SyntaxError: Missing parentheses in call to 'print'

Make configs TOML-compatible

For instance instead of:

[eg-config]
examples-dir = ~/examples-dir
custom-dir = ~/my/fancy/custom/dir

write:

[eg-config]
examples-dir = "~/examples-dir"
custom-dir = "~/my/fancy/custom/dir"

Maybe it's just a documentation mistake and configs are already written in TOML.

Better and convenient custom functionnality

Hey!

Why not create a custom dir and include its content by default ?
And add it to .gitigore

This way we can git clone, create our very custom in this folder, commit them to our personnal repo, and from time to time git pull this original repo to get updates.

What do you think about it ?

missing configuration key in the doc of the egrc

I would like eg to clean the screen after exit. Currently you use the "X" argument here to prevent the cleanup.
I can override the DEFAULT_PAGER_CMD by using [-p PAGER_CMD] but I have to type it everytime.
It would be useful to add this argument to the egrc.

Option to remove or squeeze blank lines

I arbitrarily set the number of blank lines in examples based on what was easy for me to visually parse with and without color. It's been pointed out by @cool-RR that this might be gratuitous and not the best use of screen real estate.

I like the idea of a --squeeze option that removes some of the blank lines. I'm not sure the best way to do this. Some output options I might like to support are:

1: a single blank line between all examples in a section, two lines between sections:

# tar

extract a file

    tar vfxz blah

show file contents

    tar vft blah

another example

    tar blah


# Basic Usage (notice two lines above this)

Blah blah blah.

2: Blank lines between sections, no blanks between examples (this might actually look terrible, not sure):

# tar

extract a file
    tar vfxz blah

show file contents
    tar vft blah

another example
    tar blah


# Basic Usage (notice two lines above this)

Blah blah blah.

Hmm, so maybe the places it would make sense to squeeze would be:

  • between sections (i.e. the things that begin with #)
  • within an example (although this might look ugly, as shown in number 2 up there)
  • between examples (as shown in number 1)

I'm trying to think of ways that would make sense to specify this. Maybe something like --squeeze to make everything one line, and something like --squeeze [0, 1, 2] to put 0 blank lines within an example, 1 between examples, and two between sections, if we wanted to keep it highly customizable. I like some of the blank lines and don't want to throw them out entirely.

Recursive custom-dir

Hi,

I would like to classify my md files in directories like:

~/eg
~/eg/glossary
~/eg/tech

and in my config file, just having something like:

custom-dir=~/eg

Actually, when a md file is in a subdirectory, it is not found. Is there a way to change that ?

Thanks.

Bash completion

Hi @srsudar,

Please add bash completion (TAB) for eg:

eg fi<TAB>
eg find

I don't know how is the best way to implement that functionality, but as eg is a terminal tool the tab completion is a necessary feature.

TLDR.sh updates

How are you feeding updates from TLDR.sh into eg ?

Why don't you name TLDR.sh in your readme?

Add `eg shutdown` and `eg reboot`

For reboot I use sudo reboot
For shutdown I've been taught to use sudo shutdown -h now but I don't know why I was taught -h vs -P so I tried using eg shutdown to find out what most people use. Unfortunately it doesn't exist. Maybe someone more knowledgeable than I can write an example for it.

eg is not installed

Hello, I tried installing eg on ubuntu 14.04 :
git clone https://github.com/srsudar/eg
ln -s eg/eg/eg_exec.py /usr/local/bin/eg
tried the example
eg find
it returns :
Le programme « eg » n'est pas encore installé. Vous pouvez l'installer en tapant : sudo apt-get install easygit
in english :
the "eg" program is not installed yet. You can install it by typing : sudo apt-get install easygit
Any idea of what's wrong ?
Thanks

eg do not support XDG_CONFIG_HOME

eg configuration is saved in ~/.egrc. I think eg should support XDG_CONFIG_HOME specification and save its configuration file in XDG_CONFIG_HOME.

[substitutions] section is being ignored

Substitution from README doesn't work:
~/.egrc

[substitution]
remove-indents = ['^    ', '', True]

Applying following patch:

diff --git a/eg/substitute.py b/eg/substitute.py
index b19f457..8eb006e 100644
--- a/eg/substitute.py
+++ b/eg/substitute.py
@@ -1,6 +1,6 @@
 import re
-
-
+import sys
+print('Imported Substitution', file=sys.stderr)
 class Substitution:
     """
     A substitution to be performed on a piece of text.
@@ -19,6 +19,7 @@ class Substitution:
         self.pattern = pattern
         self.repl = replacement
         self.is_multiline = is_multiline
+        print(self,file=sys.stderr)
 
     def apply_and_get_result(self, string):
         """
@@ -31,6 +32,12 @@ class Substitution:
             compiled_pattern = re.compile(self.pattern)
 
         result = re.sub(compiled_pattern, self.repl, string)
+        print(f'Did sub change anything? {result != string}',file=sys.stderr)
+        if result != string:
+            with open(f'orig.{hash(self.repl)}', 'w') as f:
+                f.write(string)
+            with open(f'subbed.{hash(self.repl)}', 'w') as f:
+                f.write(result)
         return result
 
     def __eq__(self, other):

If eg-config.squeeze = false causes following output:

Imported Substitution

while eg-config.squeeze = true causes:

Imported Substitution
<eg.substitute.Substitution object at 0x7f55c8029730>
<eg.substitute.Substitution object at 0x7f55c7bb63d0>
<eg.substitute.Substitution object at 0x7f55c7bb61c0>
Did sub change anything? True
Did sub change anything? True
Did sub change anything? False

[substitutions] section is completely ignored. Adding and removing entries from it doesn't cause above output to change. This is also confirmed by diffing orig.* and subbed.* files - only change is occasional newline removed (it looks like squeeze is done with Substitution).

Tested on latest git version with ./eg_exec.py ls >/dev/null.

Custom pager fails to load in script/function

In the file ~/.config/eg, I have:

[eg-config]
pager-cmd = 'cat'

Running eg less displays relevant information and returns me to the command line.

In a zsh function, I have:

describe_app () {
    if [ "$1" != "" ]; then
        man -f $1;
        eg $1;
        tldr $1;
        cheat $1;
    fi
}

Running describe_app less displays relevant information, but when eg runs it displays in less and does not return to the command line.

custom-dir

If I understand well, the custom-dir override a md file that is in the default-dir.

If I override the default-dir, I'll lose every md file pre installed by eg. Right?

From my understanding, I cannot have personal md files and keep the defaults one in the same time.

python x.7 code will break py3.7

eg/eg/color.py

Line 90 in f296847

compiled_pattern = re.compile(pattern, re.MULTILINE)

One of the color functions only checks if python version is < x.7. However python3.7 is now the default py version so this might start breaking systems with newer python executables.

    def _color_helper(s, text, pattern, repl):
        # < 2.7 didn't have the flags named argument.
        if sys.version_info[1] < 7:
            compiled_pattern = re.compile(pattern, re.MULTILINE)
            return re.sub(
                compiled_pattern,
                repl,
                text
            )
        else:
            return re.sub(
                pattern,
                repl,
                text,
                flags=re.MULTILINE
)

So couldn't we do
if sys.version_info < (2,7):

And be more explicit?

Maybe advise "pip install --user"

Hi,

I always look for ways to advertise pip install --user and I believe eg to be very user specific, so maybe it makes sense to change the README to say the following:

Installation

With pip For Your User

pip install --user
echo 'PATH=$PATH:$HOME/.local/bin' >> $HOME/.bashrc
exec $SHELL

What do you think?

Cheers,
Felix

PS: For those interested here is the talk where I got this idea from: Youtube / PyVideo

[SOLVED] [TerminalIPythonApp] WARNING | File not found: u'/usr/bin/eg/eg_exec.py'

Hi, first, congrats and thanks for this very helpfull program.
But I have a small problem after installing it with pip on Ubuntu (15.04), I always get this

payen:~$ sudo pip install eg

Downloading/unpacking eg
Downloading eg-0.1.1.tar.gz
Running setup.py (path:/tmp/pip-build-Skmbws/eg/setup.py) egg_info for package eg
/usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'test_requires'
warnings.warn(msg)
Installing collected packages: eg
Running setup.py install for eg
/usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'test_requires'
warnings.warn(msg)
changing mode of build/scripts-2.7/eg from 644 to 755
changing mode of /usr/local/bin/eg to 755
Successfully installed eg
Cleaning up...

payen:~$ eg tar

[TerminalIPythonApp] WARNING | File not found: u'/usr/bin/eg/eg_exec.py'

What did I did wrong ?

Examples don't respect links

@mcarton has begun adding examples with symbolic links for aliases like netcat and nc, which are the same command. #21 and #22 are two examples. This is a good idea, and something I'd thought about doing for link and ln as well, but didn't.

The system currently isn't following these links, so this approach is failing.

Can we put symbolic links in a repo and have windows as well as *nix systems respect them? I need to look into this. If it's possible, I'll have to update the code to obey it. If not, we'll have to think of something else.

Error installing on mac os

Hi,

First of all, i want to thank you for your great job.

I have a problem installing eg on mac os yosemite. I use python-2.7.9. When installing eg i got this error :

You are using pip version 6.1.0, however version 6.1.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Collecting eg
  Downloading eg-0.0.3.tar.gz
Installing collected packages: eg
  Running setup.py install for eg
    Complete output from command /usr/local/opt/python/bin/python2.7 -c "import setuptools, tokenize;__file__='/private/var/folders/6r/1yy2rml521q84_4mbl7qlgkw0000gq/T/pip-build-SquNOd/eg/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/6r/1yy2rml521q84_4mbl7qlgkw0000gq/T/pip-0SWL60-record/install-record.txt --single-version-externally-managed --compile:
    /usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'test_requires'
      warnings.warn(msg)
    running install
    running build
    running build_py
    creating build
    creating build/lib
    creating build/lib/eg
    copying eg/__init__.py -> build/lib/eg
    copying eg/eg_colorizer.py -> build/lib/eg
    copying eg/eg_config.py -> build/lib/eg
    copying eg/eg_exec.py -> build/lib/eg
    copying eg/eg_util.py -> build/lib/eg
    creating build/lib/eg/examples
    copying eg/examples/awk.md -> build/lib/eg/examples
    copying eg/examples/cat.md -> build/lib/eg/examples
    copying eg/examples/cd.md -> build/lib/eg/examples
    copying eg/examples/chmod.md -> build/lib/eg/examples
    copying eg/examples/chown.md -> build/lib/eg/examples
    copying eg/examples/cp.md -> build/lib/eg/examples
    copying eg/examples/curl.md -> build/lib/eg/examples
    copying eg/examples/cut.md -> build/lib/eg/examples
    copying eg/examples/du.md -> build/lib/eg/examples
    copying eg/examples/find.md -> build/lib/eg/examples
    copying eg/examples/gcc.md -> build/lib/eg/examples
    copying eg/examples/grep.md -> build/lib/eg/examples
    copying eg/examples/hexdump.md -> build/lib/eg/examples
    copying eg/examples/ifconfig.md -> build/lib/eg/examples
    copying eg/examples/kill.md -> build/lib/eg/examples
    copying eg/examples/less.md -> build/lib/eg/examples
    copying eg/examples/ln.md -> build/lib/eg/examples
    copying eg/examples/locate.md -> build/lib/eg/examples
    copying eg/examples/ls.md -> build/lib/eg/examples
    copying eg/examples/mkdir.md -> build/lib/eg/examples
    copying eg/examples/more.md -> build/lib/eg/examples
    copying eg/examples/mv.md -> build/lib/eg/examples
    copying eg/examples/od.md -> build/lib/eg/examples
    copying eg/examples/ps.md -> build/lib/eg/examples
    copying eg/examples/pwd.md -> build/lib/eg/examples
    copying eg/examples/rm.md -> build/lib/eg/examples
    copying eg/examples/scp.md -> build/lib/eg/examples
    copying eg/examples/sort.md -> build/lib/eg/examples
    copying eg/examples/su.md -> build/lib/eg/examples
    copying eg/examples/sudo.md -> build/lib/eg/examples
    copying eg/examples/tar.md -> build/lib/eg/examples
    copying eg/examples/top.md -> build/lib/eg/examples
    copying eg/examples/touch.md -> build/lib/eg/examples
    copying eg/examples/tr.md -> build/lib/eg/examples
    copying eg/examples/wc.md -> build/lib/eg/examples
    copying eg/examples/whatis.md -> build/lib/eg/examples
    copying eg/examples/whereis.md -> build/lib/eg/examples
    copying eg/examples/which.md -> build/lib/eg/examples
    copying eg/examples/xargs.md -> build/lib/eg/examples
    running build_scripts
    creating build/scripts-2.7
    copying and adjusting bin/eg -> build/scripts-2.7
    changing mode of build/scripts-2.7/eg from 644 to 755
    running install_lib
    creating /usr/local/lib/python2.7/site-packages/eg
    copying build/lib/eg/__init__.py -> /usr/local/lib/python2.7/site-packages/eg
    copying build/lib/eg/eg_colorizer.py -> /usr/local/lib/python2.7/site-packages/eg
    copying build/lib/eg/eg_config.py -> /usr/local/lib/python2.7/site-packages/eg
    copying build/lib/eg/eg_exec.py -> /usr/local/lib/python2.7/site-packages/eg
    copying build/lib/eg/eg_util.py -> /usr/local/lib/python2.7/site-packages/eg
    creating /usr/local/lib/python2.7/site-packages/eg/examples
    copying build/lib/eg/examples/awk.md -> /usr/local/lib/python2.7/site-packages/eg/examples
    copying build/lib/eg/examples/cat.md -> /usr/local/lib/python2.7/site-packages/eg/examples
    copying build/lib/eg/examples/cd.md -> /usr/local/lib/python2.7/site-packages/eg/examples
    copying build/lib/eg/examples/chmod.md -> /usr/local/lib/python2.7/site-packages/eg/examples
    copying build/lib/eg/examples/chown.md -> /usr/local/lib/python2.7/site-packages/eg/examples
    copying build/lib/eg/examples/cp.md -> /usr/local/lib/python2.7/site-packages/eg/examples
    copying build/lib/eg/examples/curl.md -> /usr/local/lib/python2.7/site-packages/eg/examples
    copying build/lib/eg/examples/cut.md -> /usr/local/lib/python2.7/site-packages/eg/examples
    copying build/lib/eg/examples/du.md -> /usr/local/lib/python2.7/site-packages/eg/examples
    copying build/lib/eg/examples/find.md -> /usr/local/lib/python2.7/site-packages/eg/examples
    copying build/lib/eg/examples/gcc.md -> /usr/local/lib/python2.7/site-packages/eg/examples
    copying build/lib/eg/examples/grep.md -> /usr/local/lib/python2.7/site-packages/eg/examples
    copying build/lib/eg/examples/hexdump.md -> /usr/local/lib/python2.7/site-packages/eg/examples
    copying build/lib/eg/examples/ifconfig.md -> /usr/local/lib/python2.7/site-packages/eg/examples
    copying build/lib/eg/examples/kill.md -> /usr/local/lib/python2.7/site-packages/eg/examples
    copying build/lib/eg/examples/less.md -> /usr/local/lib/python2.7/site-packages/eg/examples
    copying build/lib/eg/examples/ln.md -> /usr/local/lib/python2.7/site-packages/eg/examples
    copying build/lib/eg/examples/locate.md -> /usr/local/lib/python2.7/site-packages/eg/examples
    copying build/lib/eg/examples/ls.md -> /usr/local/lib/python2.7/site-packages/eg/examples
    copying build/lib/eg/examples/mkdir.md -> /usr/local/lib/python2.7/site-packages/eg/examples
    copying build/lib/eg/examples/more.md -> /usr/local/lib/python2.7/site-packages/eg/examples
    copying build/lib/eg/examples/mv.md -> /usr/local/lib/python2.7/site-packages/eg/examples
    copying build/lib/eg/examples/od.md -> /usr/local/lib/python2.7/site-packages/eg/examples
    copying build/lib/eg/examples/ps.md -> /usr/local/lib/python2.7/site-packages/eg/examples
    copying build/lib/eg/examples/pwd.md -> /usr/local/lib/python2.7/site-packages/eg/examples
    copying build/lib/eg/examples/rm.md -> /usr/local/lib/python2.7/site-packages/eg/examples
    copying build/lib/eg/examples/scp.md -> /usr/local/lib/python2.7/site-packages/eg/examples
    copying build/lib/eg/examples/sort.md -> /usr/local/lib/python2.7/site-packages/eg/examples
    copying build/lib/eg/examples/su.md -> /usr/local/lib/python2.7/site-packages/eg/examples
    copying build/lib/eg/examples/sudo.md -> /usr/local/lib/python2.7/site-packages/eg/examples
    copying build/lib/eg/examples/tar.md -> /usr/local/lib/python2.7/site-packages/eg/examples
    copying build/lib/eg/examples/top.md -> /usr/local/lib/python2.7/site-packages/eg/examples
    copying build/lib/eg/examples/touch.md -> /usr/local/lib/python2.7/site-packages/eg/examples
    copying build/lib/eg/examples/tr.md -> /usr/local/lib/python2.7/site-packages/eg/examples
    copying build/lib/eg/examples/wc.md -> /usr/local/lib/python2.7/site-packages/eg/examples
    copying build/lib/eg/examples/whatis.md -> /usr/local/lib/python2.7/site-packages/eg/examples
    copying build/lib/eg/examples/whereis.md -> /usr/local/lib/python2.7/site-packages/eg/examples
    copying build/lib/eg/examples/which.md -> /usr/local/lib/python2.7/site-packages/eg/examples
    copying build/lib/eg/examples/xargs.md -> /usr/local/lib/python2.7/site-packages/eg/examples
    byte-compiling /usr/local/lib/python2.7/site-packages/eg/__init__.py to __init__.pyc
    byte-compiling /usr/local/lib/python2.7/site-packages/eg/eg_colorizer.py to eg_colorizer.pyc
    byte-compiling /usr/local/lib/python2.7/site-packages/eg/eg_config.py to eg_config.pyc
    byte-compiling /usr/local/lib/python2.7/site-packages/eg/eg_exec.py to eg_exec.pyc
    byte-compiling /usr/local/lib/python2.7/site-packages/eg/eg_util.py to eg_util.pyc
    running install_egg_info
    running egg_info
    writing eg.egg-info/PKG-INFO
    writing top-level names to eg.egg-info/top_level.txt
    writing dependency_links to eg.egg-info/dependency_links.txt
    warning: manifest_maker: standard file '-c' not found

    reading manifest file 'eg.egg-info/SOURCES.txt'
    writing manifest file 'eg.egg-info/SOURCES.txt'
    Copying eg.egg-info to /usr/local/lib/python2.7/site-packages/eg-0.0.3-py2.7.egg-info
    running install_scripts
    copying build/scripts-2.7/eg -> /usr/local/bin
    error: [Errno 62] Too many levels of symbolic links: '/usr/local/bin/eg'

    ----------------------------------------
    Command "/usr/local/opt/python/bin/python2.7 -c "import setuptools, tokenize;__file__='/private/var/folders/6r/1yy2rml521q84_4mbl7qlgkw0000gq/T/pip-build-SquNOd/eg/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/6r/1yy2rml521q84_4mbl7qlgkw0000gq/T/pip-0SWL60-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/6r/1yy2rml521q84_4mbl7qlgkw0000gq/T/pip-build-SquNOd/eg

Thanks

Easily edit example files

It would be great to have shorthand to edit example files. For instance:

$ eg -c <c> edit <program>

would be equivalent to

$ $EDITOR <c>/<program>.md

(This particular syntax might be a bit ambiguous)

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.