Refactor
Signed-off-by: Oliver Davies <oliver@oliverdavies.uk>
This commit is contained in:
parent
3001ddec87
commit
6c00402b8b
1 changed files with 5 additions and 1 deletions
6
zet
6
zet
|
@ -78,7 +78,7 @@ edit_zet() {
|
|||
query="$1"
|
||||
|
||||
if [[ "$1" == "last" ]]; then
|
||||
file="$(find "$ZET_DIR" -type f -name "index.adoc" | sort | tail -1)"
|
||||
file="$(get_last_zet)"
|
||||
else
|
||||
file="$(get_filepath_for_zet "$query")"
|
||||
fi
|
||||
|
@ -124,6 +124,10 @@ get_filepath_for_zet() {
|
|||
echo "${ZET_DIR}/$1/index.adoc"
|
||||
}
|
||||
|
||||
get_last_zet() {
|
||||
find "$ZET_DIR" -type f -name "index.adoc" | sort | tail -1
|
||||
}
|
||||
|
||||
get_zet_id_from_filename() {
|
||||
basename "$(dirname "$file")"
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue