Compare commits
No commits in common. "ade3b229903534b11c4c6fdbba846a421843fc17" and "abf28116fd7f3b3734e918dd17d814bd5718598a" have entirely different histories.
ade3b22990
...
abf28116fd
2 changed files with 8 additions and 40 deletions
|
@ -2,17 +2,13 @@
|
||||||
|
|
||||||
## requirements
|
## requirements
|
||||||
|
|
||||||
`$TODOTXTPATH` needs to be set to your todo.txt path.
|
`$TODOTXTPATH` needs to be set to your todo.txt path
|
||||||
: `export TODOTXTPATH=~/todo.txt`
|
: `export TODOTXTPATH=~/todo.txt`
|
||||||
|
|
||||||
`$VIMWIKIPATH` needs to be set to your vim wiki path.
|
`$VIMWIKIPATH` needs to be set to your vim wiki path
|
||||||
: `export VIMWIKIPATH=~/wiki`
|
: `export VIMWIKIPATH=~/wiki`
|
||||||
|
|
||||||
`$MYVIMRC` needs to be set to your vimrc path.
|
|
||||||
: `export MYVIMRC=~/.vimrc`
|
|
||||||
|
|
||||||
## usage
|
## usage
|
||||||
|
|
||||||
- ./dev-env.sh xn -> extract notes
|
- ./dev-env.sh xn -> extract notes
|
||||||
- ./dev-env.sh sn -> store notes
|
- ./dev-env.sh sn -> store notes
|
||||||
- ./dev-env.sh tmux -> open default tmux env
|
|
||||||
|
|
40
dev-env.sh
40
dev-env.sh
|
@ -1,23 +1,15 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
_notes_locations_print()
|
|
||||||
{
|
|
||||||
echo "\t\ttodo.txt:\t$TODOTXTPATH"
|
|
||||||
echo "\t\twiki:\t\t$VIMWIKIPATH"
|
|
||||||
echo "\t\tvimrc\t\t$MYVIMRC"
|
|
||||||
}
|
|
||||||
|
|
||||||
_help()
|
_help()
|
||||||
{
|
{
|
||||||
echo "dev-env.sh usage: $0 [mode]"
|
echo "Usage: $0 [mode]"
|
||||||
echo "\txn: Extract notes to:"
|
echo "\txn: Extract notes to $TODOTXTPATH and $VIMWIKIPATH."
|
||||||
_notes_locations_print
|
echo "\tsn: Store notes from $TODOTXTPATH and $VIMWIKIPATH."
|
||||||
echo "\tsn: Store notes:"
|
|
||||||
_notes_locations_print
|
|
||||||
echo "\ttmux: Launch standard tmux session."
|
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_extract_notes()
|
_extract_notes()
|
||||||
{
|
{
|
||||||
if [ ! -e "./archive.tar.gz" ];
|
if [ ! -e "./archive.tar.gz" ];
|
||||||
|
@ -27,9 +19,8 @@ _extract_notes()
|
||||||
fi
|
fi
|
||||||
mkdir tmp
|
mkdir tmp
|
||||||
tar xzf archive.tar.gz -C .
|
tar xzf archive.tar.gz -C .
|
||||||
cp -r ./tmp/wiki $(dirname $VIMWIKIPATH)
|
mv ./wiki $(dirname $VIMWIKIPATH)
|
||||||
cp ./tmp/todo.txt $TODOTXTPATH
|
mv ./todo.txt $TODOTXTPATH
|
||||||
cp ./tmp/.vimrc $MYVIMRC
|
|
||||||
rm -r ./tmp
|
rm -r ./tmp
|
||||||
echo "Notes successfully extracted from archive."
|
echo "Notes successfully extracted from archive."
|
||||||
exit 0
|
exit 0
|
||||||
|
@ -40,23 +31,12 @@ _storage_notes()
|
||||||
mkdir tmp
|
mkdir tmp
|
||||||
cp $TODOTXTPATH ./tmp/
|
cp $TODOTXTPATH ./tmp/
|
||||||
cp -r $VIMWIKIPATH ./tmp/
|
cp -r $VIMWIKIPATH ./tmp/
|
||||||
cp $MYVIMRC ./tmp/
|
|
||||||
tar czf archive.tar.gz ./tmp/
|
tar czf archive.tar.gz ./tmp/
|
||||||
rm -r tmp
|
rm -r tmp
|
||||||
echo "Notes successfully stored!"
|
echo "Notes successfully stored!"
|
||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
|
|
||||||
_launch_tmux()
|
|
||||||
{
|
|
||||||
tmux new-session -d 'vim $TODOTXTPATH $VIMWIKIPATH/index.md'
|
|
||||||
tmux new-window 'bash'
|
|
||||||
tmux -2 attach-session -d
|
|
||||||
}
|
|
||||||
|
|
||||||
# main
|
|
||||||
|
|
||||||
# check for the neccessary variables
|
|
||||||
|
|
||||||
if [ -z "$VIMWIKIPATH" ];
|
if [ -z "$VIMWIKIPATH" ];
|
||||||
then
|
then
|
||||||
|
@ -70,18 +50,10 @@ then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$MYVIMRC" ];
|
|
||||||
then
|
|
||||||
echo "MYVIMRC not set."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# run the user's command
|
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
sn ) _storage_notes ;;
|
sn ) _storage_notes ;;
|
||||||
xn ) _extract_notes ;;
|
xn ) _extract_notes ;;
|
||||||
tmux ) _launch_tmux ;;
|
|
||||||
* ) _help ;;
|
* ) _help ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue