mirror of https://codeberg.org/glenneth/stash.git
Added TODO's to guile-stash.scm
This commit is contained in:
parent
74d8470c78
commit
6204c6b503
|
|
@ -54,6 +54,42 @@
|
|||
|
||||
;;; Code:
|
||||
|
||||
;; # TODO: Refactor Repeated Logic: The logic for checking if a path is a file or directory and appending the basename is repeated in the create-symlink function. This could be encapsulatedin a helper function to improve readability and avoid redundancy. e.g.
|
||||
|
||||
;; (define (build-target-path source target)
|
||||
;; (string-append target "/" (basename source)))
|
||||
|
||||
;; TODO: Modularize Conflict Handling: Separating conflict handling into its own module to keep the main functionality more focused. This will also help to extend the conflict resolution mechanism with more options (e.g., backup, replace).
|
||||
|
||||
;; #TODO: Add Logging Capabilities: It might be useful to log actions like creating symlinks, skipping conflicts, or canceling operations to a file for auditing purposes. Adding a logging function that appends these actions to a log file. e.g.
|
||||
|
||||
;; (define (log-action message)
|
||||
;; (with-output-to-file "guile-stash.log"
|
||||
;; (lambda () (display message) (newline))
|
||||
;; #:append #t))
|
||||
|
||||
;; #TODO: Improve Error Handling: While catch is used, it's broad and might not capture the exact error. Using more specific error types (like system-error and file-error) could improve the granularity of error reporting. Additionally, return appropriate exit codes for different failure conditions to support integration with other scripts.
|
||||
|
||||
;; #TODO: Optimize the delete-directory Function: Using rm -r is risky for recursive deletion in case of directory traversal attacks. You could implement a Scheme-native recursive delete function to avoid this.
|
||||
|
||||
;; #TODO: Addition of a Non-Interactive Mode: Adding a non-interactive mode that automatically skips or overwrites conflicts (based on a command-line flag) could make the script more flexible for use in automation workflows. e.g.
|
||||
|
||||
;; (define (parse-arguments args)
|
||||
;; (let* ((opts (getopt-long args
|
||||
;; '((target (value #t) (required? #t))
|
||||
;; (package-dir (value #t) (required? #t))
|
||||
;; (non-interactive (value #f) (default #f))))))
|
||||
;; opts))
|
||||
|
||||
;; #TODO: Refactor Command-Line Parsing: The current command-line argument parsing could be expanded to handle other optional flags more easily. e.g., adding help or verbose flags to improve user interaction.
|
||||
|
||||
;; #TODO: Check for Broken Symlinks: Before deciding to overwrite a symlink, check if the existing symlink is broken, and handle it appropriately. e.g.
|
||||
|
||||
;; (define (symlink-broken? path)
|
||||
;; (and (file-is-symlink? path) (not (file-exists? path))))
|
||||
|
||||
;; These changes will make the script more maintainable, secure, and flexible for future development.
|
||||
|
||||
;; Import necessary modules
|
||||
(use-modules (ice-9 getopt-long)
|
||||
(ice-9 popen) ;; Additional module for executing system commands
|
||||
|
|
|
|||
Loading…
Reference in New Issue