class SmartDirectory

Overview

outputs commands on STDERR, outputs text on STDOUT

Defined in:

sd.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new #

[View source]

Instance Method Detail

def cd_if_locked #

[View source]
def cd_to(path : String, track : Bool = true) #

[View source]
def create_shortcut(name : String, dir : String) #

[View source]
def delete_shortcut(name : String) #

[View source]
def disable_lock #

[View source]
def enable_lock(location : String) #

This function is invoked when the lock flag is recieved.


[View source]
def execute(cmd : String) #

Normal methods of executing a shell command all happen within a subshell. Thus, the only way to actually execute a command inside the invoking shell is to run eval $(program) in their shell. As a result of this limitation, sd is rather contrived. This program (the binary), when executed, prints the command it wishes to run in the invoking shell through STDERR, and normal output through STDOUT. Then, a function which is defined or sourced from the user's bashrc, config.fish, or equivalent, is created which does the following:

  1. run sd_bin
  2. print the stdout to the screen
  3. eval STDERR This is all done inside sd.* files.

[View source]
def history_step(amount) #

[View source]
def navigate #

The function that is called when sd is invoked without parameters.


[View source]
def navigate_to(location : String) #

The function that is called when sd is invoked with a single string that is not a flag. That is, location is either a directory, shortcut name, or malformed command.


[View source]
def navigate_to_shortcut(name : String) #

This function specifically navigates to a shortcut, and does not check if name is a directory. Used by --shortcut to override local dirs.


[View source]
def print_shortcuts #

[View source]
def set_default(directory : String) #

This function is invoked when the default flag is recieved.


[View source]