Skip to content

Commit

Permalink
chore: update zt, add qna
Browse files Browse the repository at this point in the history
  • Loading branch information
locphan87 committed May 29, 2021
1 parent 87fc443 commit 7cf372d
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 9 deletions.
25 changes: 25 additions & 0 deletions bin/qna
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/sh

# Sample
# qna "deck name"

echo "Creating an Anki deck"

title=$1

# YMD.HMS
DATE_FORMAT="%Y%m%d.%H%M%S"

# Replace space by dash and convert to lowercase
newTitle=$(echo $title | tr " " "-" | tr '[:upper:]' '[:lower:]')

# Making the file name
FILE_NAME=$(date +$DATE_FORMAT).$newTitle.md
echo "## $1?
" > $FILE_NAME

# Open the file and move to the 4th line
vim "+normal gg" $FILE_NAME

17 changes: 9 additions & 8 deletions bin/zt
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
#!/bin/sh


# Sample
# zt "what is deep work" "#deep-work #focus"

echo "Creating a new Zettel"

title=$1

# YMD.HMS
DATE_FORMAT="%Y%m%d.%H%M%S"

Expand All @@ -9,14 +16,8 @@ newTitle=$(echo $title | tr " " "-" | tr '[:upper:]' '[:lower:]')

# Making the file name
FILE_NAME=$(date +$DATE_FORMAT).$newTitle.md
echo "---
title: $1
tags: '$2'
address: $3
parent: $4
lang: ${5-en}
authors:
---
echo "# $1
$2
## Remarks
Expand Down
2 changes: 1 addition & 1 deletion src/cmds/gh.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ const options = {
type: 'string',
choices: ['github', 'n'],
demandOption: true,
default: 'n',
default: 'github',
},
}
const hosts = {
Expand Down

0 comments on commit 7cf372d

Please sign in to comment.