From: sabadev Date: Mon, 12 Jul 2021 00:49:51 +0000 (-0400) Subject: Factored file display out into a common method. X-Git-Url: http://sabadev.xyz:4321/?a=commitdiff_plain;h=98b76a8b65c605727bf1ac5c842b67bf575c2998;p=git-skipper.git Factored file display out into a common method. --- diff --git a/git-skipper.rkt b/git-skipper.rkt index 92f4c9b..538efa3 100644 --- a/git-skipper.rkt +++ b/git-skipper.rkt @@ -49,11 +49,14 @@ (for-each (curry interpret-input skipped-file-list modified-file-list) (parse-input input)) #f)) -(define (interactive-prompt skipped-file-list modified-file-list) +(define (display-files skipped-file-list modified-file-list) (displayln "Skipped Files:") (for-each displayln (format-numbered-list skipped-file-list)) (displayln "Modified Files:") - (for-each displayln (format-numbered-list modified-file-list)) + (for-each displayln (format-numbered-list modified-file-list))) + +(define (interactive-prompt skipped-file-list modified-file-list) + (display-files skipped-file-list modified-file-list) (displayln "Enter 's' or 'n' followed by a file number to skip or unskip a file respectively.") (displayln "e.g. 's3 n12' skips the third file under Modified Files then unskips the twelfth file under Skipped Files.") (displayln "Enter a blank line to quit.") @@ -68,29 +71,27 @@ #f)) #| Programs |# -(define (program-display-skipped-files) - (displayln "Skipped Files:") - (for-each displayln (skipped-files))) +(define (program-display-file-status) (display-files (skipped-files) (modified-files))) (define (program-skip-file file) (displayln (format "Skipping file: '~a'" file)) (skip-file file) - (program-display-skipped-files)) + (program-display-file-status)) (define (program-no-skip-file file) (displayln (format "Unskipping file: '~a'" file)) (no-skip-file file) - (program-display-skipped-files)) + (program-display-file-status)) (define (program-no-skip-all) (displayln "Unskipping every file") (no-skip-all) - (program-display-skipped-files)) + (program-display-file-status)) (define (program-skip-modified) (displayln "Skipping every modified file") (skip-modified) - (program-display-skipped-files)) + (program-display-file-status)) (define (program-interactive) (displayln "Interactive mode") @@ -99,7 +100,7 @@ (command-line #:once-any (("-i" "--interactive") "Interactive mode" (program-interactive)) - (("-l" "--list") "View skipped files" (program-display-skipped-files)) + (("-l" "--list") "View skipped and modified file status" (program-display-file-status)) (("-s" "--skip") file "Skip single file" (program-skip-file file)) (("-n" "--no-skip") file "Unskip single file" (program-no-skip-file file)) (("-p" "--no-skip-all") "Unskip every file" (program-no-skip-all))