(in-package :cl-user)
-(defun remove-empty (seq)
- (remove-if #'str:emptyp seq))
+(defvar *grep* "findstr")
-(defmacro git (input &rest arguments)
- `(remove-empty
- (mapcar #'str:trim (str:lines (uiop:run-program (list "git" ,@arguments) :force-shell t :input ,input :output :string) :omit-nulls t))))
+(defun remove-empty (text)
+ (remove-if #'str:emptyp text))
+
+(defun run-command (command)
+ (remove-empty
+ (mapcar #'str:trim
+ (str:lines
+ (uiop:run-program command :ignore-error-status t :force-shell t :input nil :output :string)
+ :omit-nulls t))))
+
+(defun git (&rest arguments)
+ (run-command (str:join " " (cons "git" arguments))))
(defun modified-files ()
- (git nil "diff" "--name-only"))
+ (git "diff" "--name-only"))
(defun skipped-files ()
- (git nil "ls-files" "-v" "|" "findstr" "^S"))
+ (git "ls-files" "-v" "|" *grep* "^S"))
(defun skip-file (file-path)
- (git nil "update-index" "--skip-worktree" file-path))
+ (git "update-index" "--skip-worktree" file-path))
(defun no-skip-file (file-path)
- (git nil "update-index" "--no-skip-worktree" file-path))
+ (git "update-index" "--no-skip-worktree" file-path))
(defun status ()
- (git nil "status"))
+ (git "status"))
(no-skip-file "git-skipper.cl")
(skip-file "git-skipper.cl")
(modified-files)
(skipped-files)
-(status)
-(git nil "commit" "-av")