Created
September 25, 2017 01:04
-
-
Save trogdoro/b314daef946e51682439532597488f0f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> @xiki .Shell action for navigating files | |
$ ls | |
|:anything | |
!.# | |
! # This shell action lets you expand the output of | |
! # the ls command, like this: | |
! # | |
! # $ ls | |
! # : etc/ | |
! # : home/ | |
! # : craig/ | |
! # : guest/ | |
! # | |
! | |
! # "$ ls", so change "|..." lines to ":..." lines... | |
! | |
! if args == [] | |
! return "|\n| This action lets you expand the output of the 'ls' shell command.\n|" if ! shell_output | |
! return shell_output.gsub(/^\|/, ':') | |
! end | |
! | |
! path = args.map{|o| o.sub(/^: /, '')}.join("/") | |
! | |
! # ": dir" line passed... | |
! | |
! if File.directory? path | |
! return Shell.command("ls -p '#{path}/'").quoted | |
! end | |
! | |
! View.open path | |
! "" # Blank string means we handled | |
! # Shell.command("cat '#{path}'").snippet | |
! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment