added configuration settings for gophermap use and date formating

This commit is contained in:
James Tomasino 2018-03-03 20:59:58 -05:00
parent d0aab3267b
commit 0b2437eb06
2 changed files with 64 additions and 19 deletions

View File

@ -30,7 +30,13 @@ burrow create-config # generate a default config file
burrow update-git # pull latest git repo for gopher dir, if exists
```
- `phlog` will prompt for the title of the post, then open it in your default
- `create-config` will auto-generate a configuration file at
`$HOME/.config/burrow/config`. It will be populated by the default parameters
listed below and provide an easy way to customize your configuration. At a
minimum you should update your `config_dir_gopher` to point to the folder on
your local computer where your gopher hole resides.
- `phlog` will prompt for the title of a new post, then open it in your default
`$EDITOR`. By default it will provide you a template, but you can override this
by including a `.template` file in your phlog directory.
@ -42,10 +48,8 @@ by including a `.template` file in your recipe box directory.
`$EDITOR`. By default it will provide you a template, but you can override this
by including a `.template` file in your topics directory.
- `create-config` gives you the same settings as you have by default without
a configuration file, but it provides you a starting point for customization.
- `update-git` is appropriate for cron jobs to keep the gopher hole in sync.
- `update-git` will silently attempt to update a git repository at the location
of your gopher hole. It is appropriate for use by a cron job.
_`man burrow` or `burrow -h` for more information._
@ -64,18 +68,29 @@ The following options are available (defaults shown):
```bash
config_dir_gopher="$HOME/gopher" # local path to gopher site
config_dir_phlog="phlog" # relative path to phlog
config_dir_recipebox="recipebox" # relative path to recipe box
config_dir_topics="topics" # relative path to topics directory
config_gopher_server="sdf.org" # server of gopher host
config_gopher_port="70" # port of gopher host
config_gopher_root="/users/username/" # absolute path on gopher host to gopher site
config_gopher_root="/users/username/" # path on gopher host to gopher site
config_dir_phlog="phlog" # relative path to phlog
config_phlog_gophermap=true # phlogs use gophermap format by default
config_phlog_usedate=true # use a date-stamp on phlog posts
config_dir_recipebox="recipebox" # relative path to recipe box
config_recipebox_gophermap=false # recipes use plain text by default
config_recipebox_usedate=false # do not use a date-stamp on recipe filenames
config_dir_topics="topics" # relative path to topics directory
config_topics_gophermap=true # topic notes use gophermap format by default
config_topics_usedate=false # do not use a date-stamp on topic filenames
config_git_commit=false # automatically commit changes if git repo
config_git_push=false # automatically push changes if git repo
config_autoindent=true # automatically reformat gophermaps with leading spaces
# and parse links at the end of file
config_autofold=false # automatically break lines at specific width
config_foldwidth=66 # width of line used for autofold
config_autoindent=true # automatically reformat gophermaps with leading spaces
# and parse links at the end of file
```
_Note: This file is a valid Bash script and will be sourced upon load._

46
burrow
View File

@ -1,6 +1,6 @@
#!/usr/bin/env bash
version="v1.2.1"
version="v1.2.3"
shopt -s extglob
configfiles="$HOME/.config/burrow/config $HOME/.config/burrow $HOME/.burrow"
@ -14,6 +14,12 @@ config_dir_topics="topics"
config_gopher_server="sdf.org"
config_gopher_port="70"
config_gopher_root="/users/username/"
config_phlog_gophermap=true
config_phlog_usedate=true
config_recipebox_gophermap=false
config_recipebox_usedate=false
config_topics_gophermap=true
config_topics_usedate=false
config_git_commit=false
config_git_push=false
config_autoindent=true
@ -311,17 +317,29 @@ function create_config() {
mkdir -p "$(dirname "$config")"
{
echo "config_dir_gopher=\"$HOME/gopher/\""
echo "config_dir_phlog=\"phlog\""
echo "config_dir_recipebox=\"recipebox\""
echo "config_dir_topics=\"topics\""
echo ""
echo "config_gopher_server=\"sdf.org\""
echo "config_gopher_port=\"70\""
echo "config_gopher_root=\"/users/username/\""
echo ""
echo "config_dir_phlog=\"phlog\""
echo "config_phlog_gophermap=true"
echo "config_phlog_usedate=true"
echo ""
echo "config_dir_recipebox=\"recipebox\""
echo "config_recipebox_gophermap=false"
echo "config_recipebox_usedate=false"
echo ""
echo "config_dir_topics=\"topics\""
echo "config_topics_gophermap=true"
echo "config_topics_usedate=false"
echo ""
echo "config_git_commit=false"
echo "config_git_push=false"
echo "config_autoindent=true"
echo ""
echo "config_autofold=false"
echo "config_foldwidth=66"
echo "config_autoindent=true"
} >> "$config"
else
echo "Configuration already exists. Abort."
@ -383,17 +401,29 @@ function main() {
if [[ ${arg_recipe} -gt 0 ]]
then
make_post "What is the name of your recipe? " "$config_dir_recipebox" false false true
make_post "What is the name of your recipe? " \
"$config_dir_recipebox" \
"$config_recipebox_gophermap" \
"$config_recipebox_usedate" \
true
fi
if [[ ${arg_topic} -gt 0 ]]
then
make_post "What is the name of your topic? " "$config_dir_topics" true false true
make_post "What is the name of your topic? " \
"$config_dir_topics" \
"$config_topics_gophermap" \
"$config_topics_usedate" \
true
fi
if [[ ${arg_phlog} -gt 0 ]]
then
make_post "Enter a title for your post: " "$config_dir_phlog" true true true
make_post "Enter a title for your post: " \
"$config_dir_phlog" \
"$config_phlog_gophermap" \
"$config_phlog_usedate" \
true
fi
}