Skip to content

Commit bde0518

Browse files
authored
feat(source): Add source and its subcommands (#203)
* feat(source): Add source and its subcommands * fix: correct logic * fix: logic * update doc
1 parent 1f46d0a commit bde0518

File tree

20 files changed

+460
-46
lines changed

20 files changed

+460
-46
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how
3636
* Add command `commnad` for custom commands (#195)
3737
* Merge the two commands `run` and `command` (#196)
3838
* Add `melpazoid` command (#202)
39+
* Add `source` command and its subcommands (#203)
3940

4041
## 0.8.x
4142
> Released Mar 08, 2023

cmds/core/source.js

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/**
2+
* Copyright (C) 2023 the Eask authors.
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 this program. If not, see <https://www.gnu.org/licenses/>.
16+
*/
17+
18+
"use strict";
19+
20+
exports.command = ['source <type>'];
21+
exports.desc = UTIL.hide_cmd('Add/Remove source from DSL');
22+
exports.builder = function (yargs) {
23+
yargs.usage(`${exports.desc}
24+
25+
Usage: eask source <type> [options..]`)
26+
.commandDir('../source/')
27+
.demandCommand();
28+
29+
/* XXX: Configure only in the menu. */
30+
if (UTIL.cmd_count() == 1) {
31+
yargs.positional(
32+
'<type>', {
33+
description: 'type of the control',
34+
});
35+
}
36+
}
37+
38+
exports.handler = async (argv) => {};

cmds/link/delete.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
"use strict";
1919

20-
exports.command = ['delete [names..]'];
20+
exports.command = ['delete [names..]', 'remove [names..]'];
2121
exports.desc = 'Delete local linked packages';
2222
exports.builder = yargs => yargs
2323
.positional(

cmds/source/add.js

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/**
2+
* Copyright (C) 2023 the Eask authors.
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 this program. If not, see <https://www.gnu.org/licenses/>.
16+
*/
17+
18+
"use strict";
19+
20+
exports.command = ['add <name> [url]'];
21+
exports.desc = 'Add an archive source';
22+
exports.builder = yargs => yargs
23+
.positional(
24+
'<name>', {
25+
description: 'name of the archive',
26+
type: 'array',
27+
})
28+
.positional(
29+
'[url]', {
30+
description: 'link to the archive',
31+
type: 'string',
32+
});
33+
34+
exports.handler = async (argv) => {
35+
await UTIL.e_call(argv, 'source/add', argv.name, argv.url);
36+
};

cmds/source/delete.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/**
2+
* Copyright (C) 2023 the Eask authors.
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 this program. If not, see <https://www.gnu.org/licenses/>.
16+
*/
17+
18+
"use strict";
19+
20+
exports.command = ['delete <name>', 'remove <name>'];
21+
exports.desc = 'Remove an archive source';
22+
exports.builder = yargs => yargs
23+
.positional(
24+
'<name>', {
25+
description: 'name of the archive',
26+
type: 'array',
27+
});
28+
29+
exports.handler = async (argv) => {
30+
await UTIL.e_call(argv, 'source/delete', argv.name);
31+
};
32+

cmds/source/list.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/**
2+
* Copyright (C) 2023 the Eask authors.
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 this program. If not, see <https://www.gnu.org/licenses/>.
16+
*/
17+
18+
"use strict";
19+
20+
exports.command = ['list'];
21+
exports.desc = 'List all source information';
22+
23+
exports.handler = async (argv) => {
24+
await UTIL.e_call(argv, 'source/list');
25+
};
26+

docs/content/en/Getting-Started/Basic-Usage/_index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ Here is a list of known nested subcommands:
146146
- eask link
147147
- eask lint
148148
- eask run
149+
- eask source
149150
- eask test
150151
151152
## 📌 Knowing your `elpa` directory

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

Lines changed: 47 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -328,12 +328,12 @@ $ eask [GLOBAL-OPTIONS] run script [NAMES..]
328328

329329
Run the command.
330330

331+
Alias: `cmd`
332+
331333
```sh
332334
$ eask [GLOBAL-OPTIONS] run command [NAMES..]
333335
```
334336

335-
Alias: `cmd`
336-
337337
## 🔍 eask docker
338338

339339
Launch specified Emacs version in a Docker container.
@@ -540,6 +540,8 @@ $ eask [GLOBAL-OPTIONS] link add <name> <path>
540540

541541
Deletes the link for the given packages.
542542

543+
Alias: `remove`
544+
543545
```sh
544546
$ eask [GLOBAL-OPTIONS] link delete [names..]
545547
```
@@ -558,6 +560,8 @@ $ eask [GLOBAL-OPTIONS] link list
558560

559561
Delete `.eask` from the current workspace.
560562

563+
Alias: `.eask`
564+
561565
```sh
562566
$ eask [GLOBAL-OPTIONS] clean workspace
563567
```
@@ -568,8 +572,6 @@ $ eask [GLOBAL-OPTIONS] clean workspace
568572
$ eask clean workspace -g
569573
```
570574

571-
Alias: `.eask`
572-
573575
## 🔍 eask clean elc
574576

575577
Delete all `.elc` files. This would respect to your `Eask` file.
@@ -582,12 +584,12 @@ $ eask [GLOBAL-OPTIONS] clean elc
582584

583585
Delete dist subdirectory.
584586

587+
Alias: `distribution`
588+
585589
```sh
586590
$ eask [GLOBAL-OPTIONS] clean dist
587591
```
588592

589-
Alias: `distribution`
590-
591593
## 🔍 eask clean autoloads
592594

593595
Remove generated autoloads file.
@@ -623,13 +625,13 @@ This command is the combination of all other clean commands.
623625
- `clean pkg-file`
624626
- `clean log-file`
625627

628+
Alias: `everything`
629+
626630
```sh
627631
$ eask [GLOBAL-OPTIONS] clean all
628632
```
629633

630-
Alias: `everything`
631-
632-
# 🚩 Linter
634+
# 🚩 Linting
633635

634636
Commands that lint your Emacs package.
635637

@@ -711,12 +713,12 @@ $ eask [GLOBAL-OPTIONS] lint declare [FILES..]
711713

712714
Run [relint](https://github.com/mattiase/relint).
713715

716+
Alias: `lint relint`
717+
714718
```sh
715719
$ eask [GLOBAL-OPTIONS] lint regexps [FILES..]
716720
```
717721

718-
Alias: `lint relint`
719-
720722
# 🚩 Testing
721723

722724
## 🔍 eask test activate
@@ -769,6 +771,40 @@ $ eask [GLOBAL-OPTIONS] test melpazoid [DIRECTORIES..]
769771
💡 If **[DIRECTORIES..]** is not passed in; it will use the current workspace instead.
770772
{{< /hint >}}
771773

774+
# 🚩 Control DSL
775+
776+
List of commands that control DSL.
777+
778+
## 🔍 eask source add
779+
780+
Add an archive source.
781+
782+
```sh
783+
$ eask [GLOBAL-OPTIONS] source add <NAME> [URL]
784+
```
785+
786+
## 🔍 eask source delete
787+
788+
Remove an archive source.
789+
790+
Alias: `remove`
791+
792+
```sh
793+
$ eask [GLOBAL-OPTIONS] source delete <NAME>
794+
```
795+
796+
## 🔍 eask source list
797+
798+
List all source information.
799+
800+
```sh
801+
$ eask [GLOBAL-OPTIONS] source list
802+
```
803+
804+
{{< hint info >}}
805+
💡 This command is the same as `$ eask archives`!
806+
{{< /hint >}}
807+
772808
# 🚩 Utilities
773809

774810
Other helper commands.

docs/content/en/Getting-Started/Introduction.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,11 @@ list.
114114

115115
### 🔍 Core commands
116116

117-
- [ ] [FEAT] Add `publish` command; to publish package to eask archive?
117+
- [ ] [FEAT] Add `publish` command; to publish the package to the eask archive?
118118

119119
### 🔍 Eask-file commands
120120

121-
- [ ] [FEAT] Add `add-source` command
121+
- N/A
122122

123123
## 📂 Underlying Projects
124124

docs/content/zh-TW/Getting-Started/Basic-Usage/_index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ Positionals:
141141
- eask link
142142
- eask lint
143143
- eask run
144+
- eask source
144145
- eask test
145146
146147
## 📌 了解你的 `elpa` 目錄

0 commit comments

Comments
 (0)