mirror of https://git.envs.net/envs/burrow.git
add edit-config action
This commit is contained in:
parent
6ba34bf60f
commit
09472ab21a
|
@ -44,6 +44,7 @@ burrow phlog # create new phlog post
|
|||
burrow recipe # add or update a recipe to box
|
||||
burrow topic # add or update a topic file
|
||||
burrow create-config # generate a default config file
|
||||
burrow edit-config # open your config file for editing
|
||||
burrow update-git # pull latest git repo for gopher dir, if exists
|
||||
```
|
||||
|
||||
|
@ -53,6 +54,8 @@ 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.
|
||||
|
||||
- `edit-config` will open your burrow configuration file for easy editing.
|
||||
|
||||
- `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.
|
||||
|
|
21
burrow
21
burrow
|
@ -40,6 +40,7 @@ arg_recipe=0
|
|||
arg_phlog=0
|
||||
arg_topic=0
|
||||
arg_create_config=0
|
||||
arg_edit_config=0
|
||||
arg_update_git=0
|
||||
|
||||
# silence directory movements
|
||||
|
@ -60,6 +61,7 @@ COMMANDS:
|
|||
recipe Add new recipe to box
|
||||
topic Add or update a topic
|
||||
create-config Create a default configuration file
|
||||
edit-config Edit your configuration file
|
||||
update-git Silently pulls gopher git repo if it exists
|
||||
|
||||
OPTIONAL FLAGS:
|
||||
|
@ -126,6 +128,7 @@ function parse_input {
|
|||
"recipe") arg_recipe=1 ;;
|
||||
"topic") arg_topic=1 ;;
|
||||
"create-config") arg_create_config=1 ;;
|
||||
"edit-config") arg_edit_config=1 ;;
|
||||
"update-git") arg_update_git=1 ;;
|
||||
*) echo "Unknown command: $arg";;
|
||||
esac
|
||||
|
@ -336,6 +339,18 @@ function make_post {
|
|||
fi
|
||||
}
|
||||
|
||||
function edit_config {
|
||||
if [[ -f "$HOME/.config/burrow/config" ]]; then
|
||||
$EDITOR "$HOME/.config/burrow/config"
|
||||
elif [[ -f "$HOME/.config/burrow" ]]; then
|
||||
$EDITOR "$HOME/.config/burrow"
|
||||
elif [[ -f "$HOME/.burrow" ]]; then
|
||||
$EDITOR "$HOME/.burrow"
|
||||
else
|
||||
die "No configuration found" 0
|
||||
fi
|
||||
}
|
||||
|
||||
function create_config {
|
||||
if [[ ! -f "$HOME/.config/burrow/config" ]] && \
|
||||
[[ ! -f "$HOME/.config/burrow" ]] && \
|
||||
|
@ -386,7 +401,7 @@ function main {
|
|||
parse_input "$@"
|
||||
|
||||
if [[ $arg_shortlist -gt 0 ]]; then
|
||||
out="phlog topic recipe create-config update-git -v -h -d"
|
||||
out="phlog topic recipe edit-config create-config update-git -v -h -d"
|
||||
# include long options only if using gnu getopt
|
||||
getopt -T > /dev/null
|
||||
if [ $? -eq 4 ]; then
|
||||
|
@ -411,6 +426,10 @@ function main {
|
|||
create_config
|
||||
fi
|
||||
|
||||
if [[ $arg_edit_config -gt 0 ]]; then
|
||||
edit_config
|
||||
fi
|
||||
|
||||
for configfile in $configfiles; do
|
||||
if [[ -f $configfile ]]; then
|
||||
source "$configfile"
|
||||
|
|
3
burrow.1
3
burrow.1
|
@ -22,6 +22,9 @@ Generates a default configuration file at
|
|||
if no other configuration file exists. It is populated with the default
|
||||
settings.
|
||||
.TP
|
||||
.B edit-config
|
||||
Opens your burrow configuration file for editing if it exists.
|
||||
.TP
|
||||
.B update-git
|
||||
If the gopher directory resides within a git repository, this action will do a
|
||||
silent
|
||||
|
|
Loading…
Reference in New Issue