Browse Source

Ability to add and clear tags through environment variables

master
wjak56@gmail.com 9 years ago
parent
commit
4eed9a1ddd
  1. 9
      api.rkt
  2. 14
      tagadd.rkt
  3. 5
      tagadd.sh
  4. 4
      tagclear.sh

9
api.rkt

@ -402,7 +402,7 @@
(define (get-current-tag post)
(hash-ref current-tags
(format "~a_tags"
(regexp-replace* #px"\\|\\." post "_"))
(regexp-replace* #px"\\/|\\." post "_"))
#f))
@ -450,8 +450,8 @@
(let* ([post-status (car post-file)]
[post (cadr post-file)]
[categories (get-categories post)]
[tags (check-tags post current-tags)])
(displayln tags)
[tags (check-tags post)])
(displayln current-tags)
(match (git-href post #f)
@ -490,4 +490,5 @@
password
username
xstring
in-blog?)
in-blog?
add-tag-env)

14
tagadd.rkt

@ -0,0 +1,14 @@
#! /usr/bin/racket
#lang racket
(require "api.rkt")
(define argv
(current-command-line-arguments))
(displayln
(add-tag-env
(vector-ref argv 0)
(vector-ref argv 1)))
(displayln (environment-variables-names (current-environment-variables)))

5
tagadd.sh

@ -0,0 +1,5 @@
#! /usr/bin/bash
# add a tag to the environment
name="$(echo "$(realpath --relative-to=/home/wes/myblog ${1})" | sed "s/[\:\.\/\\ \n]/_/g")_tags"
export "$name"="${!name}:#${2}"

4
tagclear.sh

@ -0,0 +1,4 @@
#! /usr/bin/bash
name="$(echo "$(realpath --relative-to=/home/wes/myblog ${1})" | sed "s/[\:\.\/\\ \n]/_/g")_tags"
unset "$name"
Loading…
Cancel
Save