Skip to content

Commit

Permalink
feat(source): Add source and its subcommands
Browse files Browse the repository at this point in the history
  • Loading branch information
jcs090218 committed Nov 13, 2023
1 parent 1f46d0a commit 3cdf038
Show file tree
Hide file tree
Showing 17 changed files with 416 additions and 38 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how
* Add command `commnad` for custom commands (#195)
* Merge the two commands `run` and `command` (#196)
* Add `melpazoid` command (#202)
* Add `source` command and its subcommands (#203)

## 0.8.x
> Released Mar 08, 2023
Expand Down
38 changes: 38 additions & 0 deletions cmds/core/source.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/**
* Copyright (C) 2023 the Eask authors.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

"use strict";

exports.command = ['source <type>'];
exports.desc = UTIL.hide_cmd('Add/Remove source from DSL');
exports.builder = function (yargs) {
yargs.usage(`${exports.desc}
Usage: eask source <type> [options..]`)
.commandDir('../source/')
.demandCommand();

/* XXX: Configure only in the menu. */
if (UTIL.cmd_count() == 1) {
yargs.positional(
'<type>', {
description: 'type of the control',
});
}
}

exports.handler = async (argv) => {};
2 changes: 1 addition & 1 deletion cmds/link/delete.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

"use strict";

exports.command = ['delete [names..]'];
exports.command = ['delete [names..]', 'remove [names..]'];
exports.desc = 'Delete local linked packages';
exports.builder = yargs => yargs
.positional(
Expand Down
36 changes: 36 additions & 0 deletions cmds/source/add.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/**
* Copyright (C) 2023 the Eask authors.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

"use strict";

exports.command = ['add <name> [url]'];
exports.desc = 'Add an archive source';
exports.builder = yargs => yargs
.positional(
'<name>', {
description: 'name of the archive',
type: 'array',
})
.positional(
'[url]', {
description: 'link to the archive',
type: 'string',
});

exports.handler = async (argv) => {
await UTIL.e_call(argv, 'source/add', argv.name, argv.url);
};
32 changes: 32 additions & 0 deletions cmds/source/delete.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/**
* Copyright (C) 2023 the Eask authors.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

"use strict";

exports.command = ['delete <name>', 'remove <name>'];
exports.desc = 'Remove an archive source';
exports.builder = yargs => yargs
.positional(
'<name>', {
description: 'name of the archive',
type: 'array',
});

exports.handler = async (argv) => {
await UTIL.e_call(argv, 'source/delete', argv.name);
};

26 changes: 26 additions & 0 deletions cmds/source/list.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/**
* Copyright (C) 2023 the Eask authors.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

"use strict";

exports.command = ['list'];
exports.desc = 'List all source information';

exports.handler = async (argv) => {
await UTIL.e_call(argv, 'source/list');
};

1 change: 1 addition & 0 deletions docs/content/en/Getting-Started/Basic-Usage/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ Here is a list of known nested subcommands:
- eask link
- eask lint
- eask run
- eask source
- eask test

## 📌 Knowing your `elpa` directory
Expand Down
58 changes: 47 additions & 11 deletions docs/content/en/Getting-Started/Commands-and-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -328,12 +328,12 @@ $ eask [GLOBAL-OPTIONS] run script [NAMES..]

Run the command.

Alias: `cmd`

```sh
$ eask [GLOBAL-OPTIONS] run command [NAMES..]
```

Alias: `cmd`

## 🔍 eask docker

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

Deletes the link for the given packages.

Alias: `remove`

```sh
$ eask [GLOBAL-OPTIONS] link delete [names..]
```
Expand All @@ -558,6 +560,8 @@ $ eask [GLOBAL-OPTIONS] link list

Delete `.eask` from the current workspace.

Alias: `.eask`

```sh
$ eask [GLOBAL-OPTIONS] clean workspace
```
Expand All @@ -568,8 +572,6 @@ $ eask [GLOBAL-OPTIONS] clean workspace
$ eask clean workspace -g
```

Alias: `.eask`

## 🔍 eask clean elc

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

Delete dist subdirectory.

Alias: `distribution`

```sh
$ eask [GLOBAL-OPTIONS] clean dist
```

Alias: `distribution`

## 🔍 eask clean autoloads

Remove generated autoloads file.
Expand Down Expand Up @@ -623,13 +625,13 @@ This command is the combination of all other clean commands.
- `clean pkg-file`
- `clean log-file`

Alias: `everything`

```sh
$ eask [GLOBAL-OPTIONS] clean all
```

Alias: `everything`

# 🚩 Linter
# 🚩 Linting

Commands that lint your Emacs package.

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

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

Alias: `lint relint`

```sh
$ eask [GLOBAL-OPTIONS] lint regexps [FILES..]
```

Alias: `lint relint`

# 🚩 Testing

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

# 🚩 Control DSL

List of commands that control DSL.

## 🔍 eask source add

Add an archive source.

```sh
$ eask [GLOBAL-OPTIONS] source add <NAME> [URL]
```

## 🔍 eask source delete

Remove an archive source.

Alias: `remove`

```sh
$ eask [GLOBAL-OPTIONS] source delete <NAME>
```

## 🔍 eask source list

List all source information.

```sh
$ eask [GLOBAL-OPTIONS] source list
```

{{< hint info >}}
💡 This command is the same as `$ eask archives`!
{{< /hint >}}

# 🚩 Utilities

Other helper commands.
Expand Down
4 changes: 2 additions & 2 deletions docs/content/en/Getting-Started/Introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,11 @@ list.

### 🔍 Core commands

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

### 🔍 Eask-file commands

- [ ] [FEAT] Add `add-source` command
- [x] [FEAT] Add `source add` command

## 📂 Underlying Projects

Expand Down
1 change: 1 addition & 0 deletions docs/content/zh-TW/Getting-Started/Basic-Usage/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ Positionals:
- eask link
- eask lint
- eask run
- eask source
- eask test

## 📌 了解你的 `elpa` 目錄
Expand Down
Loading

0 comments on commit 3cdf038

Please sign in to comment.