Commit graph

11 commits

Author SHA1 Message Date
Jonathan Hodgson
2175699660 Fix issue where added files whern't renamed 2020-12-31 17:39:41 +00:00
Jonathan Hodgson
cac4584bdf Fix bug when editing a file title
The file needs to be moved although the tags weren't being updated
properly
2020-12-31 00:07:20 +00:00
Jonathan Hodgson
73894bb252 Make the update and view file changes use all command line positions
Instead of using $1 for file names, $* is used which results in spaces
being allowed without quoting.

This is in line with how the new command works.

As an example, it means the command

```
kb edit this is a test
```

will try and edit a file with the title "this is a test" rather than
"this"
2020-12-30 19:26:15 +00:00
Jonathan Hodgson
05e5cac976 Fix 2 bugs. Deleting file without yaml file and multi-word delete
The first bug output an error if trying to stage the deletion of the
yaml file if the file never existed. The error is now piped to /dev/null
and `|| true` is appended to the line which causes the script to carry
on execution

The second change is when deleting a file, you no longer have to quote
the file name if it is a multi word file. This puts it in line with the
new command
2020-12-30 19:21:31 +00:00
Jonathan Hodgson
6206986546 Fix handling of yaml files when deleting entries 2020-12-30 17:25:04 +00:00
Jonathan Hodgson
a3bbe9b4a2 Adds the ability to add files that already exist
Work on #16

This was a relatively large amount of work. It introduces assets which
are stored in the assets sub directory and stored in the database with
the asset type in the database.
2020-12-30 16:42:47 +00:00
Jonathan Hodgson
d70f5398a3 Adds the ability to index folder and re-populate the db
Misc:
The arguments are now sorted alphabetically in the main funciton

close #4
2020-12-22 09:38:04 +00:00
Jonathan Hodgson
0ac730ca3c Adds pager option and uses $PAGER environment variable
Due to bat also reading the $PAGER environment variable, I first look to
see if bat is available. If it is, I use that. If it isn't, I use the
$PAGER environment variable. If that's not available, I use cat.

I also added the --editor flag to the help output which had clearly been
missed

Close #12
2020-12-22 08:58:53 +00:00
Jonathan Hodgson
f8d04a304a Adds key combinations for fuzzy search
Currently:
* ctrl-n - new file from query
* ctrl-o - view file
* ctrl-e - edit file
* ctrl-d - delete file

close #11
2020-12-21 18:28:13 +00:00
Jonathan Hodgson
caab854c09 Adds update command for externally modified files
This can be used when a file is modified externally. It will update the
sqlite database and potentially run git commands for the change.

If there are 2 files provided, it assumes that the file was moved. The
first filename should be the old file.

The new, edit and delete functions were also re factored slightly to use
this new update function.

Relevant to #4
Close #2
Close #1
2020-12-20 20:04:52 +00:00
Jonathan Hodgson
ac031344d3 Splits up file into smaller files
Closes issue #9
2020-12-20 17:07:17 +00:00