diff options
author | Brian McKenna <brian@simpleenergy.com> | 2014-02-18 14:37:59 -0700 |
---|---|---|
committer | Brian McKenna <brian@simpleenergy.com> | 2014-02-18 14:37:59 -0700 |
commit | 358b6ffcde9e3732ed08387fc176851e07c1862f (patch) | |
tree | 95aaa55c195cdbe2307b0fed783410857ac1891b /plugins/cabal/cabal.plugin.zsh | |
parent | 4ce7f0a37f9a13c605225e2a595ad1bdf6171065 (diff) | |
download | zsh-358b6ffcde9e3732ed08387fc176851e07c1862f.tar.gz zsh-358b6ffcde9e3732ed08387fc176851e07c1862f.tar.bz2 zsh-358b6ffcde9e3732ed08387fc176851e07c1862f.zip |
Add cabal_sandbox_info function
Reports whether the current working directory is within a
sandbox. Useful to check before installing Cabal packages into the
global registry.
Diffstat (limited to 'plugins/cabal/cabal.plugin.zsh')
-rw-r--r-- | plugins/cabal/cabal.plugin.zsh | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/plugins/cabal/cabal.plugin.zsh b/plugins/cabal/cabal.plugin.zsh index 8d3c64587..9f76add7a 100644 --- a/plugins/cabal/cabal.plugin.zsh +++ b/plugins/cabal/cabal.plugin.zsh @@ -1,3 +1,14 @@ +function cabal_sandbox_info() { + cabal_files=(*.cabal(N)) + if [ $#cabal_files -gt 0 ]; then + if [ -f cabal.sandbox.config ]; then + echo "%{$fg[green]%}sandboxed%{$reset_color%}" + else + echo "%{$fg[red]%}not sandboxed%{$reset_color%}" + fi + fi +} + function _cabal_commands() { local ret=1 state _arguments ':subcommand:->subcommand' && ret=0 |