jigarius/gup

Provision for forcing argument as `numeric`

Closed this issue · 1 comments

The problem

  • Say, a user is in /a/2/b/c/d and they want to go to 2.
  • Typing gup 2 will take them to /a/2/b, i.e. 2 levels up.
  • There should be a way to force the argument as alphanumeric / dirname

Proposed solution

  • Create a switch which will force gup to treat the argument as a dirname

Running gup with a number, say, gup 5 now does the following:

  • If an ancestor directory named 5 exists, you go there.
  • If an ancestor directory named 5 doesn't exists, you go 5 levels up.

However, you can force 5 to be treated as a number with the --number or -n flag.
Running gup -n 5 takes you 5 levels up, even if an ancestor directory named 5 exists.