Skip to content

Commit

Permalink
Merge pull request #111 from armindarvish/develop
Browse files Browse the repository at this point in the history
update for making package
  • Loading branch information
armindarvish authored Jul 28, 2024
2 parents 1881f6f + 9e19bb9 commit 077c076
Show file tree
Hide file tree
Showing 5 changed files with 202 additions and 126 deletions.
7 changes: 5 additions & 2 deletions consult-gh-embark.el
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,16 @@
;; Author: Armin Darvish
;; Maintainer: Armin Darvish
;; Created: 2023
;; Version: 1.0.1
;; Package-Requires: ((emacs "27.1") (consult "0.34") (consult-gh "1.0.1"))
;; Version: 1.0
;; Package-Requires: ((emacs "29.1") (consult "1.0") (consult-gh "1.0"))
;; Homepage: https://github.com/armindarvish/consult-gh
;; Keywords: matching, git, repositories, forges, completion

;;; Commentary:

;; This package provides embark actions for consult-gh.
;; (see URL `https://github.com/armindarvish/consult-gh' for more info).

;;; Code:

;;; Requirements
Expand Down
21 changes: 14 additions & 7 deletions consult-gh-forge.el
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@
;; Author: Armin Darvish
;; Maintainer: Armin Darvish
;; Created: 2023
;; Version: 1.0.1
;; Package-Requires: ((emacs "27.1") (consult "0.34") (forge "0.3.3") (consult-gh "1.0.1"))
;; Version: 1.0
;; Package-Requires: ((emacs "29.1") (consult "1.0") (forge "0.3.3") (consult-gh "1.0"))
;; Homepage: https://github.com/armindarvish/consult-gh
;; Keywords: matching, git, repositories, forges, completion

;;; Commentary:
;; This package provides forge integration for consult-gh.
;; (see URL `https://github.com/armindarvish/consult-gh' for more info).

;;; Code:

Expand Down Expand Up @@ -67,11 +69,15 @@ for `forge-add-repository'."


(defun consult-gh-forge--remove-repository (host owner name)
"Remove the forge defined by OWNER/HOST/NAME from `forge-database'."
"Remove the forge defined by OWNER/HOST/NAME.
Removes the forge from the list in variable `forge-database'."
(closql-delete (forge-get-repository (list host owner name))))

(defun consult-gh-forge--remove-repository-by-url (url)
"Remove the forge defined by URL from `forge-database'."
"Remove the forge defined by URL.
Removes the forge from the list in variable `forge-database'."
(let* ((forge-repo (forge-get-repository url))
(owner (oref forge-repo owner))
(name (oref forge-repo name))
Expand All @@ -89,10 +95,11 @@ The repos are stored in `conuslt-gh-forge--aded-repositories'."
(mapcar #'consult-gh-forge--remove-repository-by-url urls)))

(defun consult-gh-forge-remove-repository (&optional urls)
"Ask the user to select forges to be removed from `forge-database'.
"Ask the user to select forges to be removed.
Only lists the repositories added by consult-gh
\(stored in `consult-gh-forge--added-repositories'\).
Lists forges added by `consult-gh'
\(stored in `consult-gh-forge--added-repositories'\) and
removes them from the list in variable `forge-database'.
If optional argument URLS is non-nil, remove the forges of the URLS."
(interactive)
Expand Down
26 changes: 14 additions & 12 deletions consult-gh-transient.el
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@
;; Author: Armin Darvish
;; Maintainer: Armin Darvish
;; Created: 2023
;; Version: 1.0.1
;; Package-Requires: ((emacs "27.1") (consult "0.34") (consult-gh "1.0.1"))
;; Version: 1.0
;; Package-Requires: ((emacs "29.1") (consult "1.0") (consult-gh "1.0"))
;; Homepage: https://github.com/armindarvish/consult-gh
;; Keywords: matching, git, repositories, forges, completion

;;; Commentary:
;; This package providesa transient menu for consult-gh.
;; (see URL `https://github.com/armindarvish/consult-gh' for more info).

;;; Code:

Expand All @@ -19,8 +21,9 @@
(require 'transient)

;; Prefixes
(transient-define-prefix consult-gh ()
"Main transient menu for consult-gh"
;;;###autoload
(transient-define-prefix consult-gh-transient ()
"Main transient menu for `consult-gh'."
[:description
(lambda ()
(let ((username (consult-gh--get-current-username))
Expand Down Expand Up @@ -61,15 +64,14 @@
(consult-gh-transient--infix-issue-state)
(consult-gh-transient--infix-prs-state)]])


(defun consult-gh--transient-read-variable (prompt initial-input history)
(defun consult-gh-transient-read-variable (prompt initial-input history)
"Read value from minibuffer for `consult-gh' transient menu.
PROMPT, INITIAL-INPUT, and HISTORY are passed to `read-from-minibffer'."
(read-from-minibuffer prompt initial-input read-expression-map t history))

;; Prefixes
(transient-define-prefix consult-gh--transient-repos ()
(transient-define-prefix consult-gh-transient-repos ()
"Repo section for `consult-gh' transient menu."
[:description "Repos"]
[["Actions"
Expand All @@ -78,7 +80,7 @@ PROMPT, INITIAL-INPUT, and HISTORY are passed to `read-from-minibffer'."
["Parameters"
(consult-gh-transient--infix-repo-maxnum)]])

(transient-define-prefix consult-gh--transient-issues ()
(transient-define-prefix consult-gh-transient-issues ()
"Issue section for `consult-gh' transient menu."
[:description "Issues"]
[["Actions"
Expand All @@ -94,31 +96,31 @@ PROMPT, INITIAL-INPUT, and HISTORY are passed to `read-from-minibffer'."
:class 'transient-lisp-variable
:variable 'consult-gh-repo-maxnum
:key "r -L"
:reader 'consult-gh--transient-read-variable)
:reader 'consult-gh-transient-read-variable)

(transient-define-infix consult-gh-transient--infix-issue-maxnum ()
"Set `consult-gh-issue-maxnum' in `consult-gh' transient menu."
:description "Max Number of Issues: "
:class 'transient-lisp-variable
:variable 'consult-gh-issue-maxnum
:key "i -L"
:reader 'consult-gh--transient-read-variable)
:reader 'consult-gh-transient-read-variable)

(transient-define-infix consult-gh-transient--infix-pr-maxnum ()
"Set `consult-gh-pr-maxnum' in `consult-gh' transient menu."
:description "Max Number of PRs: "
:class 'transient-lisp-variable
:variable 'consult-gh-pr-maxnum
:key "p -L"
:reader 'consult-gh--transient-read-variable)
:reader 'consult-gh-transient-read-variable)

(transient-define-infix consult-gh-transient--infix-code-maxnum ()
"Set `consult-gh-code-maxnum' in `consult-gh' transient menu."
:description "Max Number of Codes: "
:class 'transient-lisp-variable
:variable 'consult-gh-code-maxnum
:key "c -L"
:reader 'consult-gh--transient-read-variable)
:reader 'consult-gh-transient-read-variable)

(transient-define-infix consult-gh-transient--infix-issue-state ()
"Set `consult-gh-issues-state-to-show' in `consult-gh' transient menu."
Expand Down
Loading

0 comments on commit 077c076

Please sign in to comment.