Skip to content

Commit b1f9595

Browse files
authored
feat: Add command clean pkg-file (#99)
* feat: Add command clean pkg-file * changelog * impls all
1 parent 6b4e272 commit b1f9595

File tree

6 files changed

+68
-0
lines changed

6 files changed

+68
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how
3232
* Add command to create ELPA project (#94)
3333
* Add command to clean log files (#97)
3434
* Add command to clean autoloads file (#98)
35+
* Add command to clean pkg-file (#99)
3536

3637
## 0.7.x
3738
> Released Sep 08, 2022

cmds/clean/pkg-file.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/**
2+
* Copyright (C) 2023 Jen-Chieh Shen
3+
*
4+
* This program is free software; you can redistribute it and/or modify
5+
* it under the terms of the GNU General Public License as published by
6+
* the Free Software Foundation; either version 3, or (at your option)
7+
* any later version.
8+
*
9+
* This program is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU General Public License
15+
* along with GNU Emacs; see the file COPYING. If not, write to the
16+
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17+
* Boston, MA 02110-1301, USA.
18+
*/
19+
20+
"use strict";
21+
22+
exports.command = ['pkg-file'];
23+
exports.desc = 'Remove generated pkg-file';
24+
25+
exports.handler = async (argv) => {
26+
await UTIL.e_call(argv, 'clean/pkg-file');
27+
};

docs/content/en/Getting Started/Commands and options.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,14 @@ Remove generated autoloads file.
364364
$ eask [GLOBAL-OPTIONS] clean autoloads
365365
```
366366

367+
## 🔍 eask clean pkg-file
368+
369+
Remove generated pkg-file.
370+
371+
```sh
372+
$ eask [GLOBAL-OPTIONS] clean pkg-file
373+
```
374+
367375
## 🔍 eask clean log-file
368376

369377
Remove all generated log files.
@@ -380,6 +388,7 @@ This command is the combination of all other clean commands.
380388
- `clean elc`
381389
- `clean dist`
382390
- `clean autoloads`
391+
- `clean pkg-file`
383392
- `clean log-file`
384393

385394
```sh

lisp/clean/all.el

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@
3939
(eask--clean-section "Cleaning autoloads file"
4040
(eask-call "clean/autoloads"))
4141
(eask-msg "")
42+
(eask--clean-section "Cleaning pkg-file"
43+
(eask-call "clean/pkg-file"))
44+
(eask-msg "")
4245
(eask--clean-section "Cleaning log files"
4346
(eask-call "clean/log-file")))
4447

lisp/clean/pkg-file.el

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
;;; clean/pkg-file.el --- Remove generated pkg-file -*- lexical-binding: t; -*-
2+
3+
;;; Commentary:
4+
;;
5+
;; Remove generated pkg-file,
6+
;;
7+
;; $ eask clean pkg-file
8+
;;
9+
10+
;;; Code:
11+
12+
(load (expand-file-name
13+
"../_prepare.el"
14+
(file-name-directory (nth 1 (member "-scriptload" command-line-args))))
15+
nil t)
16+
17+
(eask-start
18+
(let* ((name (eask-guess-package-name))
19+
(pkg-file (expand-file-name (concat name "-pkg.el")))
20+
(deleted (eask-delete-file pkg-file)))
21+
(eask-msg "")
22+
(if deleted
23+
(eask-info "(Total of 1 file deleted)")
24+
(eask-info "(No pkg-file found in workspace)")
25+
(setq eask-no-cleaning-operation-p t))))
26+
27+
;;; clean/pkg-file.el ends here

test/commands/local/run.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ eask clean .eask
7272
eask clean elc
7373
eask clean dist
7474
eask clean autoloads
75+
eask clean pkg-file
7576
eask clean log-file
7677
eask clean all
7778

0 commit comments

Comments
 (0)