diff options
author | Arun Isaac | 2022-06-22 18:25:16 +0530 |
---|---|---|
committer | Arun Isaac | 2022-06-22 20:46:17 +0530 |
commit | 89c6c8718bdd1a113e31e192d16bd0694d332b09 (patch) | |
tree | d2c72a7e0ec936ee949a8585a8afaae64f052b2a /bin | |
parent | 32d5e62a222fc1c542758016325839cdc705cd28 (diff) | |
download | tissue-89c6c8718bdd1a113e31e192d16bd0694d332b09.tar.gz tissue-89c6c8718bdd1a113e31e192d16bd0694d332b09.tar.lz tissue-89c6c8718bdd1a113e31e192d16bd0694d332b09.zip |
bin: Run with the top-level directory as the current directory.
If we always run with the top-level directory as the current
directory, we don't need to frequently discover the top-level
directory by walking the filesystem. Also, this sits nicer with a
migration from git to libgit2.
* bin/tissue (main): Run all subcommands with the top-level directory
as the current directory.
(load-config): Load tissue.scm without appending the top-level
directory to it.
(tissue-web): Find the top-level directory using getcwd instead of
git-top-level.
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/tissue | 36 |
1 files changed, 19 insertions, 17 deletions
@@ -355,7 +355,7 @@ Show the text of issue #ISSUE-NUMBER. (memoize-thunk (lambda () "Load configuration and return <tissue-configuration> object." - (load (string-append (git-top-level) "/tissue.scm"))))) + (load (canonicalize-path "tissue.scm"))))) (define tissue-repl (match-lambda* @@ -393,7 +393,7 @@ Export the repository as a website to OUTPUT-DIRECTORY. (parameterize ((%project-name (tissue-configuration-project (load-config))) (%tags-path (tissue-configuration-web-tags-path (load-config)))) - (build-website (git-top-level) + (build-website (getcwd) output-directory (tissue-configuration-web-css (load-config)) (tissue-configuration-web-files (load-config))))))) @@ -428,21 +428,23 @@ To get usage information for one of these sub-commands, run (current-error-port)) (newline (current-error-port)) (exit #f))) - (parameterize ((%issue-files (tissue-configuration-issue-files (load-config))) - (%aliases (tissue-configuration-aliases (load-config)))) - (apply (match command - ("news" tissue-news) - ("list" tissue-list) - ("edit" tissue-edit) - ("show" tissue-show) - ("repl" tissue-repl) - ("web" tissue-web) - (invalid-command - (format (current-error-port) "Invalid command `~a'~%~%" - invalid-command) - (print-usage) - (exit #f))) - args)))) + (call-with-current-directory (git-top-level) + (lambda () + (parameterize ((%issue-files (tissue-configuration-issue-files (load-config))) + (%aliases (tissue-configuration-aliases (load-config)))) + (apply (match command + ("news" tissue-news) + ("list" tissue-list) + ("edit" tissue-edit) + ("show" tissue-show) + ("repl" tissue-repl) + ("web" tissue-web) + (invalid-command + (format (current-error-port) "Invalid command `~a'~%~%" + invalid-command) + (print-usage) + (exit #f))) + args)))))) ;; tissue is an alias for `tissue list' ((_) (main "tissue" "list")))) |