summaryrefslogtreecommitdiff
path: root/.pc/10-shebang.patch/contrib/scripts/dir2org.zsh
diff options
context:
space:
mode:
authorS├ębastien Delafond <sdelafond@gmail.com>2014-07-13 13:35:27 +0200
committerS├ębastien Delafond <sdelafond@gmail.com>2014-07-13 13:35:27 +0200
commite32a45ed36d6000db4b39171149072d11b77af72 (patch)
treeb5f4a7d43022c08c3298e82b3e9fc50f68be660f /.pc/10-shebang.patch/contrib/scripts/dir2org.zsh
parent7697fa4daf3ec84f85711a84035d8f0224afd4e3 (diff)
Imported Upstream version 8.0.7
Diffstat (limited to '.pc/10-shebang.patch/contrib/scripts/dir2org.zsh')
-rwxr-xr-x.pc/10-shebang.patch/contrib/scripts/dir2org.zsh56
1 files changed, 0 insertions, 56 deletions
diff --git a/.pc/10-shebang.patch/contrib/scripts/dir2org.zsh b/.pc/10-shebang.patch/contrib/scripts/dir2org.zsh
deleted file mode 100755
index f91ff17..0000000
--- a/.pc/10-shebang.patch/contrib/scripts/dir2org.zsh
+++ /dev/null
@@ -1,56 +0,0 @@
-#!/usr/bin/env zsh
-
-# desc:
-#
-# Output an org compatible structure representing the filesystem from
-# the point passed on the command line (or . by default).
-#
-# options:
-# none
-#
-# usage:
-# dir2org.zsh [DIR]...
-#
-# author:
-# Phil Jackson (phil@shellarchive.co.uk)
-
-set -e
-
-function headline {
- local depth="${1}"
- local text="${2}"
-
- printf "%${depth}s %s" "" | tr ' ' '*'
- echo " ${text}"
-}
-
-function scan_and_populate {
- local depth="${1}"
- local dir="${2}"
-
- headline ${depth} "${dir}"
-
- # if there is no files in dir then just move on
- [[ $(ls "${dir}" | wc -l) -eq 0 ]] && return
-
- (( depth += 1 ))
-
- for f in $(ls -d "${dir}"/*); do
- if [ -d "${f}" ]; then
- scan_and_populate ${depth} "${f}"
- else
- headline ${depth} "[[file://${f}][${${f##*/}%.*}]]"
- fi
- done
-
- (( depth -= 1 ))
-}
-
-function main {
- local scan_dir="${1:-$(pwd)}"
- local depth=0
-
- scan_and_populate ${depth} "${scan_dir}"
-}
-
-main "${@}"