From: Saba Saba Date: Thu, 9 Feb 2023 17:26:17 +0000 (-0500) Subject: Added extra commands and switched name to git-repl.cl X-Git-Url: http://sabadev.xyz:4321/?a=commitdiff_plain;h=f5ce2ec1dd4e470a52d56e02b2a0b7cb7c4bc4b0;p=git-repl.git Added extra commands and switched name to git-repl.cl --- diff --git a/git-repl.cl b/git-repl.cl new file mode 100644 index 0000000..8517012 --- /dev/null +++ b/git-repl.cl @@ -0,0 +1,58 @@ +; sbcl --load git-repl.cl + +(ql:quickload '("cl-utilities" "str")) + +(in-package :cl-user) + +(defvar *grep* "findstr") + +(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 status () + (git "status")) + +(defun add-all () + (git "add" ".")) + +(defun commit () + (git "commit" "-v")) + +(defun modified-files () + (git "diff" "--name-only")) + +(defun skipped-files () + (mapcar (lambda (x) (str:substring 2 t x)) (git "ls-files" "-v" "|" *grep* "^S"))) + +(defun skip-file (file-path) + (git "update-index" "--skip-worktree" file-path)) + +(defun no-skip-file (file-path) + (git "update-index" "--no-skip-worktree" file-path)) + +(defun skip-modified () + (mapcar #'skip-file (modified-files))) + +(defun no-skip-all () + (mapcar #'no-skip-file (skipped-files))) + +(defun delete-branch (branch-name) + (git "branch" "-d" branch-name)) + +(defun delete-merged-branches () + (mapcar #'delete-branch (git "branch" "--merged"))) + +(defun make (executable-name) + (progn + (load (compile-file "git-repl.cl")) + (save-lisp-and-die executable-name :executable t))) diff --git a/git-skipper-load.cl b/git-skipper-load.cl deleted file mode 100644 index 18d8df5..0000000 --- a/git-skipper-load.cl +++ /dev/null @@ -1,4 +0,0 @@ -(load (compile-file "git-skipper.cl")) -(save-lisp-and-die "git-skipper.exe" :executable t) - -; sbcl --load git-skipper.cl diff --git a/git-skipper.cl b/git-skipper.cl deleted file mode 100644 index fbf8290..0000000 --- a/git-skipper.cl +++ /dev/null @@ -1,49 +0,0 @@ -; sbcl --load git-skipper.cl - -(ql:quickload '("cl-utilities" "str")) - -(in-package :cl-user) - -(defvar *grep* "findstr") - -(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 "diff" "--name-only")) - -(defun skipped-files () - (mapcar (lambda (x) (str:substring 2 t x)) (git "ls-files" "-v" "|" *grep* "^S"))) - -(defun skip-file (file-path) - (git "update-index" "--skip-worktree" file-path)) - -(defun no-skip-file (file-path) - (git "update-index" "--no-skip-worktree" file-path)) - -(defun skip-modified () - (mapcar #'skip-file (modified-files))) - -(defun no-skip-all () - (mapcar #'no-skip-file (skipped-files))) - -(defun delete-branch (branch-name) - (git "branch" "-d" branch-name)) - -(defun delete-merged-branches () - (mapcar #'delete-branch (git "branch" "--merged"))) - -(defun make () - (progn - (load (compile-file "git-skipper.cl")) - (save-lisp-and-die "git-skipper.exe" :executable t)))