dot

packages and services management
Log | Files | Refs | README

commit ccca21486c9acc3b5ecf351c84a923d469e5bbae
parent dc09b354ac4f19e8810eacba2c45a02979c86c5c
Author: josuah <mail@josuah.net>
Date:   Fri,  4 Nov 2016 16:05:37 -0400

Much cleanup

Diffstat:
Mbin/buffers | 5+----
Mbin/config-link | 6+++---
Mbin/www | 86+++++++++++++++++++++++++++++++++++++------------------------------------------
Dshell/status-line | 0
Dtmux/.config/tmux/new-session | 20--------------------
Dtmux/.config/tmux/status | 101-------------------------------------------------------------------------------
6 files changed, 44 insertions(+), 174 deletions(-)

diff --git a/bin/buffers b/bin/buffers @@ -96,10 +96,7 @@ run() alsamixer ) options='-c 1' ;; - ping ) - options='-c 3 www.wikipedia.org' - ;; - Gop | mail | mailx | s-nail | rirc | agenda | music | iirc ) + mail | mailx | s-nail | music | iirc ) options='' ;; diff --git a/bin/config-link b/bin/config-link @@ -6,12 +6,12 @@ LOCAL="${LOCAL:-$LOCAL}" # # Link all dotfiles # -find "$CONFIG" -type f -path '*/.*' ! -path "*/.git/*" | while read path +find "$CONFIG" -type f -path '*/.*' ! -path "*/.git/*" | while IFS='' read -r f do - destination="$HOME/${path#$CONFIG/*/}" + destination="$HOME/${f#$CONFIG/*/}" mkdir -p "${destination%/*}" - ln -sf "$path" "$destination" + ln -sf "$f" "$destination" done # diff --git a/bin/www b/bin/www @@ -3,52 +3,45 @@ # `-'-' `-'-' `-'-' 2016-11-04 #------------------------------------------------------------------------------- # Static website generator +# +# +# NAME +# www - static website generator +# +# USAGE +# www +# +# DESCRIPTION +# INPUT Source directory from which generate the website +# +# FILES +# INPUT/%s +# File containing the pages layout +# +# INPUT/_* +# Any file starting by "_" will be ignored +# +# INPUT/*/README +# The "README" files content can be displayed on the pages. +# +# LAYOUT FORMAT +# Within a layout.html, there is some templating features, using keywords. +# +# {{ content }} +# Content of README file in the current directory. +# {{ list }} +# List of subpages for the current directory. +# {{ nav }} +# List of top level directories, for use as a <nav> element. +# {{ root }} +# Relative path to the root of the website, for relative links. +# {{ title }} +# Page title, given by the path, with "/" replaced by " > ". LAYOUT="layout.html" -help() -{ - printf ' -NAME - www - static website generator - -USAGE - www - -DESCRIPTION - INPUT Source directory from which generate the website - -FILES - INPUT/%s - File containing the pages layout - - INPUT/_* - Any file starting by "_" will be ignored - - INPUT/*/README - The "README" files content can be displayed on the pages. - -LAYOUT FORMAT - Within a layout.html, there is some templating features, using keywords. - - {{ content }} - Content of README file in the current directory. - {{ list }} - List of subpages for the current directory. - {{ nav }} - List of top level directories, for use as a <nav> element. - {{ root }} - Relative path to the root of the website, for relative links. - {{ title }} - Page title, given by the path, with "/" replaced by " > ". -' "$LAYOUT" - - exit 1 -} - - parse() { local item="$1" input="$2" @@ -129,19 +122,20 @@ nav() main() { - [ "$#" -gt 0 ] || [ ! -f layout.html ] && help + if [ "$#" -gt 0 ] || [ ! -f layout.html ] + then + printf '%s: no "%s" file in "%s"\n' "${0##*/}" "$LAYOUT" "$PWD" + exit 1 + fi # delete previously generated "index.html" files find -name index.html -exec rm {} \; # create index.html pages for each non-dotfile directory - find . -mindepth 1 ! -path '*/.*' -type d | while IFS='' read -r d + find . ! -path '*/.*' -type d | while IFS='' read -r d do parse "${d#./}" "$(cat "$LAYOUT")" > "$d/index.html" done - - # create home page, without listing "style.css", "favicon.png", ... - parse '.' "$(cat "$LAYOUT")" > index.html } main $@ diff --git a/shell/status-line b/shell/status-line diff --git a/tmux/.config/tmux/new-session b/tmux/.config/tmux/new-session @@ -1,20 +0,0 @@ -#!/bin/sh -# * -# ---. ,--. , , , ,--- ,--. ,--- ,--- , ,--. ---. -# | | |--' | | | --- `--. |--' `--. `--. | | | | | -# ' ' `--' `-'-' ---' `--' ---' ---' ' `--' ' ' 2016-10-08 -#------------------------------------------------------------------------------- - -dir="$( - find "$HOME/" -maxdepth 3 ! -path '*/.*' -type d | while read line - do printf '%s\n' "~${line#$HOME}" - done | iomenu -)" - -cd "$HOME${dir#\~}" - -dir="${dir##*/}" -dir="$(printf '%s\n' "$dir" | cut -c 1 | tr [a-z] [A-Z])${dir#?}" -tmux rename-session "$dir" - -clear diff --git a/tmux/.config/tmux/status b/tmux/.config/tmux/status @@ -1,101 +0,0 @@ -#!/bin/sh -# | | -# ,--- |-- ,--. |-- , , ,--- -# `--. | ,--| | | | `--. -# ---' ' `--` ' `--` ---' 2016-10-08 -#------------------------------------------------------------------------------- -# Status line, with tmux color escape sequence - - -# VARIABLES 2016-10-05 -#------------------------------------------------------------------------------- - -help='USAGE: ~/.tmux/status segmentname1 segmentname2 ...' -PWD="$(tmux display -p '#{pane_current_path}')" - -BACKGROUND=black -SEPARATOR="${SEPARATOR- }" - - -# FUNCTIONS 2016-10-05 -#------------------------------------------------------------------------------- -# -# Each segment's function has to print 3 lines: -# -# 1 The color -# -# 2 The label, with $color as background -# -# 3 The text, with $color as foreground -# -# Any of them can be empty, and any can contain aditionnal tmux color escape -# sequences: #[fg=color1,bg=color2,bold] - -segment_mail() -{ - local count='' inbox='' - - count="$(find "$MAIL/new" -type f 2>/dev/null | wc -l)" - [ "$count" -le 0 ] && count='' || mail='mail' - - printf '%s\n' cyan "$mail" "$count" -} - -segment_dir() -{ - local pwd='' - - [ "${PWD##$HOME**}" ] && pwd="$PWD" || pwd="~${PWD#$HOME}" - - printf '%s\n' white "" "$pwd" -} - -segment_git() -{ - local color='' branch='' status='' - - cd "$PWD" - if git rev-parse &> /dev/null - then - branch="$(git branch | sed -n 's/^\* // p')" - status="$(git status --porcelain | wc -l)" - - [ "$status" -gt 0 ] && color=red || color=green - fi - - printf '%s\n' "$color" "$branch" "${status#0}" -} - -segment_clock() -{ - printf '%s\n' white '' "$(date +'%Y-%m-%d #[reverse] %H:%M')" -} - - -# ALGORYTHM 2016-10-05 -#------------------------------------------------------------------------------- - -for segment in $@ -do - "segment_$1" | { - read color - read label - read text - - if [ "$label" ] - then printf '#[bg=%s,fg=%s] %s #[default]' \ - "$color" black "$label" - fi - - if [ "$text" ] - then printf '#[bg=%s,fg=%s] %s #[default]' \ - "$BACKGROUND" "$color" "$text" - fi - - if [ "$label$text" -a $# -gt 1 ] - then printf '%s' "$SEPARATOR" - fi - } - - shift -done