Skip to content

Commit

Permalink
feat(config): support project manifest in Cargo.toml
Browse files Browse the repository at this point in the history
  • Loading branch information
liuyinz committed Mar 31, 2024
1 parent ceb3055 commit af38ef1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ generate and update changelog for project. Call `git-cliff-menu` to start.

### dependencies

- [git-cliff][git-cliff], version >= 2.1.2
- [git-cliff][git-cliff], version >= 2.2
- emacs, version >= 29.1
- transient >= 0.5.0

Expand Down
24 changes: 13 additions & 11 deletions git-cliff.el
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
(and (fboundp 'markdown-view-mode) (markdown-view-mode))
(read-only-mode 1)))

(defun git-cliff--locate (dir &optional full regexp)
(defun git-cliff--locate (dir &optional regexp full)
"Return a list of git cliff config in DIR.
If FULL is non-nil, return absolute path, otherwise relative path according
to DIR. If REGEXP is non-nil, match configurations by REGEXP instead of
Expand Down Expand Up @@ -152,15 +152,17 @@ ARGS are as same as `completing-read'."
;; config
(defun git-cliff--configs ()
"Return a list of git-cliff configs available for current working directory."
(nconc (git-cliff--locate (git-cliff--get-repository))
(git-cliff--locate
(convert-standard-filename
(concat (getenv "HOME")
(cl-case system-type
(darwin "/Library/Application Support/git-cliff/")
((cygwin windows-nt ms-dos) "/AppData/Roaming/git-cliff/")
(_ "/.config/git-cliff/"))))
t git-cliff-config-regexp)))
(let ((dir (git-cliff--get-repository)))
(nconc (git-cliff--locate dir)
(git-cliff--locate dir "\\`Cargo\\.toml\\'")
(git-cliff--locate
(convert-standard-filename
(concat (getenv "HOME")
(cl-case system-type
(darwin "/Library/Application Support/git-cliff/")
((cygwin windows-nt ms-dos) "/AppData/Roaming/git-cliff/")
(_ "/.config/git-cliff/"))))
nil t))))

(defun git-cliff--set-config (prompt &rest _)
"Read and set config file for current working directory with PROMPT."
Expand Down Expand Up @@ -320,7 +322,7 @@ This command will commit all staged files by default."
nil
"Select a config: "
(git-cliff--locate git-cliff-extra-dir
nil "\\.\\(to\\|ya\\)ml\\'")
"\\.\\(to\\|ya\\)ml\\'")
nil t))
(newname (concat "cliff." (file-name-extension config))))
;; kill buffer and rename file
Expand Down

0 comments on commit af38ef1

Please sign in to comment.