Giter VIP home page Giter VIP logo

cde's People

Contributors

jalanb avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

cde's Issues

Explain to user why that directory was chosen

Add an option, --logging, which shows user a (high-level) description of why directory was chosen.

If used with "-" (previous directory), then show why last directory was chosen

Choose a specific directory from history

Suppose I do

$ kd /usr/local/bin
$ ks /usr/bin

And now I want to do

$ kd -o bin

by which I mean - choose the "...bin" from history and cd there. That will always find more than 1 possibility, and choose the most recent, which will be /usr/bin. Actually I mean /usr/local/bin. At present I need to list all history, copy the full path, and "kd ". But, listing the path assigns a unique number to each path, so I should be able to use that number to

$ kd -o 2

which would bring me to the 2nd path on the list, which would be the the desired /usr/local/bin in the example

Add version

kd is mature enough to deserve a version number.

AFAICT it is currently at version 0.2.0, as 0.1 was basic functionality, and 0.2 added history.

Clean history

Add an option to purge any items from history which are

  1. Not existing paths
  2. Duplicates
  3. Chosen by user
    1. By number
    2. By partial match (if ambiguous remove both)
    3. So that * clears the history completely

Tests broken

I've not been keeping up with test results in all ways of running them, hence:

$ kd -t
**********************************************************************
File "/Users/user/kd/kd.tests", line 75, in kd.tests
Failed example:
    kd.find_directory('/usr', ['li'])
Expected:
    Traceback (most recent call last):
    ...
    TryAgain: Too many possiblities
             0: /usr/lib
             1: /usr/libexec
Got:
    Traceback (most recent call last):
      File "/usr/local/lib/python2.7/doctest.py", line 1254, in __run
        compileflags, 1) in test.globs
      File "<doctest kd.tests[23]>", line 1, in <module>
        kd.find_directory('/usr', ['li'])
      File "/Users/user/kd/kd.py", line 277, in find_directory
        path_to_prefix = find_under_directory(path_to_item, prefixes)
      File "/Users/user/kd/kd.py", line 189, in find_under_directory
        raise TryAgain('Too many possiblities\n\t%s' % as_menu_string(possibles))
    TryAgain: Too many possiblities
         0: /usr/lib
         1: /usr/libexec

Consistency in order of evaluation

kd should use similar criteria for searching through possibilities for

  1. sub-directories under a root
  2. items in a history

These will be similar, not identical, as (e.g.) the former might include files, the latter won't. But they should be consistent - if one search values names over globs, then the other should too.

Project structure

Create sub-directories for code, test, docs

Consider standard root-level files, such as README, COPYING, INSTALL

Choose a numbered directory from history

When the arguments do not allow kd to choose one directory it stops, showing the user the list of possible choices, e.g.

$ c /tmp bi
Error: Too many possiblities
/tmp/bib
/tmp/bin

That list of choices should be enumerated, e.g.

$ c /tmp bi
Please be more specific
 1: /tmp/bib
 2: /tmp/bin

User should then be able to repeat the command and choose one (i.e. hit <up arrow>, <number>, <return>). kd now goes to the chosen directory.

$ c /tmp bi 2
cd /tmp/bin

This makes the list of ambiguous choices look like the history list, hence same facility should be available from the history list: user says

$ kd -l

to show the list, which are shown numbered. user then hits <up arrow>, <number>, <return>, command now looks like

$ kd -l 5

so kd goes to 5th item in history list

Allow user to choose time format

History current shows time as (e.g.) "3 hours 4 minutes ago"

User should have the option to use other formats, e.g. "Fri 13 Sep 2013 00:11:53 IST".

Formats could be those offered by the date command (i.e. strptime)

Improve documentation

kd is now big enough to need better documentation that just a docstring and a readme file.

Suggested

  1. Ensure readme is consistent with docstring
  2. Rethink both from user's POV
  3. Add documentation for installation
  4. Consider ReadTheDocs and even a man page

Installation

At present kd requires a "super user" to download and install.

Consider available installation strategies for other users:

  1. pip/easy_install?
  2. Tarball with install script?

kd -o uses home directory

The -o option allows one to choose an "old" path (one from history). Hence it should be followed by a string to choose, so this is expected (when looking for "stuff" in history)

$ kd -o stuff

And this should be an error:

$ kd -o

In practice the latter actually uses $HOME, which is often in the history, so it goes home. It should be an error

Consider frecency

My current version of frecency is simply:

Sort by number of times used, then by time since last use

This is very much a first draft and for example, leads to problems when moving a directory which was often used - the old place stays high in rankings till the new is used more often.

See also

  1. https://github.com/rupa/z/wiki/frecency
  2. http://blog.ram.rachum.com/post/33095461928/developers-when-using-frecency-please-consider-the
  3. https://developer.mozilla.org/en-US/docs/The_Places_frecency_algorithm

Quick hack before a deeper strategy: allow user to edit the history file. Currently it is plain text, so editable, but not the most user-friendly format (e.g. epoch times)

https://app.leanboard.io/board/c162cc7d-0d36-4b9c-b5df-0507c3e74b5f

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.