class SmartDirectory
- SmartDirectory
- Reference
- Object
Overview
outputs commands on STDERR, outputs text on STDOUT
Defined in:
sd.crConstructors
Instance Method Summary
- #cd_if_locked
- #cd_to(path : String, track : Bool = true)
- #create_shortcut(name : String, dir : String)
- #delete_shortcut(name : String)
- #disable_lock
-
#enable_lock(location : String)
This function is invoked when the lock flag is recieved.
-
#execute(cmd : String)
Normal methods of executing a shell command all happen within a subshell.
- #history_step(amount)
-
#navigate
The function that is called when sd is invoked without parameters.
-
#navigate_to(location : String)
The function that is called when sd is invoked with a single string that is not a flag.
-
#navigate_to_shortcut(name : String)
This function specifically navigates to a shortcut, and does not check if name is a directory.
- #print_shortcuts
-
#set_default(directory : String)
This function is invoked when the default flag is recieved.
Constructor Detail
Instance Method Detail
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:
- run sd_bin
- print the stdout to the screen
- eval STDERR This is all done inside sd.* files.