Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions cmds/clean/all.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@

"use strict";

exports.command = ['all', 'everything'];
exports.desc = 'Do all cleaning tasks';
import { e_call } from '../../src/util.js';

exports.handler = async (argv) => {
await UTIL.e_call(argv, 'clean/all');
export const command = ['all', 'everything'];
export const desc = 'Do all cleaning tasks';

export const handler = async (argv) => {
await e_call(argv, 'clean/all');
};
10 changes: 6 additions & 4 deletions cmds/clean/autoloads.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@

"use strict";

exports.command = ['autoloads'];
exports.desc = 'Remove the generated autoloads file';
import { e_call } from '../../src/util.js';

exports.handler = async (argv) => {
await UTIL.e_call(argv, 'clean/autoloads', argv.dest);
export const command = ['autoloads'];
export const desc = 'Remove the generated autoloads file';

export const handler = async (argv) => {
await e_call(argv, 'clean/autoloads', argv.dest);
};
12 changes: 7 additions & 5 deletions cmds/clean/dist.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,18 @@

"use strict";

exports.command = ['dist [destination]', 'distribution [destination]'];
exports.desc = 'Delete the dist directory where the build output is stored';
exports.builder = yargs => yargs
import { e_call } from '../../src/util.js';

export const command = ['dist [destination]', 'distribution [destination]'];
export const desc = 'Delete the dist directory where the build output is stored';
export const builder = yargs => yargs
.positional(
'destination', {
description: 'destination path/folder to clean up',
alias: 'dest',
type: 'string',
});

exports.handler = async (argv) => {
await UTIL.e_call(argv, 'clean/dist', argv.dest);
export const handler = async (argv) => {
await e_call(argv, 'clean/dist', argv.dest);
};
10 changes: 6 additions & 4 deletions cmds/clean/elc.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@

"use strict";

exports.command = ['elc'];
exports.desc = 'Remove byte compiled files generated by eask compile';
import { e_call } from '../../src/util.js';

exports.handler = async (argv) => {
await UTIL.e_call(argv, 'clean/elc');
export const command = ['elc'];
export const desc = 'Remove byte compiled files generated by eask compile';

export const handler = async (argv) => {
await e_call(argv, 'clean/elc');
};
10 changes: 6 additions & 4 deletions cmds/clean/log-file.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@

"use strict";

exports.command = ['log-file'];
exports.desc = 'Remove all generated log files';
import { e_call } from '../../src/util.js';

exports.handler = async (argv) => {
await UTIL.e_call(argv, 'clean/log-file');
export const command = ['log-file'];
export const desc = 'Remove all generated log files';

export const handler = async (argv) => {
await e_call(argv, 'clean/log-file');
};
10 changes: 6 additions & 4 deletions cmds/clean/pkg-file.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@

"use strict";

exports.command = ['pkg-file'];
exports.desc = 'Remove the generated pkg-file';
import { e_call } from '../../src/util.js';

exports.handler = async (argv) => {
await UTIL.e_call(argv, 'clean/pkg-file');
export const command = ['pkg-file'];
export const desc = 'Remove the generated pkg-file';

export const handler = async (argv) => {
await e_call(argv, 'clean/pkg-file');
};
10 changes: 6 additions & 4 deletions cmds/clean/workspace.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@

"use strict";

exports.command = ['workspace', '.eask'];
exports.desc = 'Clean up the .eask directory';
import { e_call } from '../../src/util.js';

exports.handler = async (argv) => {
await UTIL.e_call(argv, 'clean/workspace');
export const command = ['workspace', '.eask'];
export const desc = 'Clean up the .eask directory';

export const handler = async (argv) => {
await e_call(argv, 'clean/workspace');
};
19 changes: 11 additions & 8 deletions cmds/core/analyze.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,12 @@

"use strict";

exports.command = ['analyze [files..]'];
exports.desc = 'Run Eask checker';
exports.builder = yargs => yargs
import { TITLE_CMD_OPTION } from "../../src/env.js";
import { e_call, def_flag } from '../../src/util.js';

export const command = ['analyze [files..]'];
export const desc = 'Run Eask checker';
export const builder = yargs => yargs
.positional(
'[files..]', {
description: 'specify Eask-files for checker to lint',
Expand All @@ -39,9 +42,9 @@ exports.builder = yargs => yargs
},
});

exports.handler = async (argv) => {
await UTIL.e_call(argv, 'core/analyze'
, argv.files
, UTIL.def_flag(argv.json, '--json')
, UTIL.def_flag(argv.output, '--output', argv.output));
export const handler = async (argv) => {
await e_call(argv, 'core/analyze'
, argv.files
, def_flag(argv.json, '--json')
, def_flag(argv.output, '--output', argv.output));
};
10 changes: 6 additions & 4 deletions cmds/core/archives.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@

"use strict";

exports.command = ['archives', 'sources'];
exports.desc = 'List out all package archives';
import { e_call } from '../../src/util.js';

exports.handler = async (argv) => {
await UTIL.e_call(argv, 'core/archives');
export const command = ['archives', 'sources'];
export const desc = 'List out all package archives';

export const handler = async (argv) => {
await e_call(argv, 'core/archives');
};
14 changes: 8 additions & 6 deletions cmds/core/bump.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,18 @@

"use strict";

exports.command = ['bump [levels..]'];
exports.desc = UTIL.hide_cmd('Bump version for your project');
exports.builder = yargs => yargs
import { e_call, hide_cmd } from '../../src/util.js';

export const command = ['bump [levels..]'];
export const desc = hide_cmd('Bump version for your project');
export const builder = yargs => yargs
.positional(
'[levels..]', {
description: "version level to bump; accept `major', `minor' or `patch'",
type: 'array',
});

exports.handler = async (argv) => {
await UTIL.e_call(argv, 'core/bump'
, argv.levels);
export const handler = async (argv) => {
await e_call(argv, 'core/bump'
, argv.levels);
};
17 changes: 10 additions & 7 deletions cmds/core/cat.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,12 @@

"use strict";

exports.command = ['cat <patterns..>', 'type <patterns..>'];
exports.desc = UTIL.hide_cmd('View filename(s)');
exports.builder = yargs => yargs
import { TITLE_CMD_OPTION } from "../../src/env.js";
import { e_call, hide_cmd, def_flag } from '../../src/util.js';

export const command = ['cat <patterns..>', 'type <patterns..>'];
export const desc = hide_cmd('View filename(s)');
export const builder = yargs => yargs
.positional(
'<patterns..>', {
description: 'patterns you want to search (wildcard)',
Expand All @@ -35,8 +38,8 @@ exports.builder = yargs => yargs
},
});

exports.handler = async (argv) => {
await UTIL.e_call(argv, 'core/cat'
, argv.patterns
, UTIL.def_flag(argv.number, '--number'));
export const handler = async (argv) => {
await e_call(argv, 'core/cat'
, argv.patterns
, def_flag(argv.number, '--number'));
};
19 changes: 12 additions & 7 deletions cmds/core/clean.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,27 @@

"use strict";

exports.command = ['clean <type>'];
exports.desc = 'Delete various files produced during building';
exports.builder = function (yargs) {
yargs.usage(`${exports.desc}
import path from 'path';
import { cmd_count } from '../../src/util.js';

const __dirname = import.meta.dirname;

export const command = ['clean <type>'];
export const desc = 'Delete various files produced during building';
export const builder = function (yargs) {
yargs.usage(`${desc}

Usage: eask clean <type> [options..]`)
.commandDir('../clean/')
.commandDir(path.join(__dirname, '../clean/'))
.demandCommand();

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

exports.handler = async (argv) => { };
export const handler = async (argv) => { };
15 changes: 9 additions & 6 deletions cmds/core/compile.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,12 @@

"use strict";

exports.command = ['compile [names..]'];
exports.desc = "Byte-compile `.el' files";
exports.builder = yargs => yargs
import { TITLE_CMD_OPTION } from "../../src/env.js";
import { e_call, def_flag } from '../../src/util.js';

export const command = ['compile [names..]'];
export const desc = "Byte-compile `.el' files";
export const builder = yargs => yargs
.positional(
'[names..]', {
description: 'specify files to byte-compile',
Expand All @@ -33,8 +36,8 @@ exports.builder = yargs => yargs
},
});

exports.handler = async (argv) => {
await UTIL.e_call(argv, 'core/compile'
export const handler = async (argv) => {
await e_call(argv, 'core/compile'
, argv.names
, UTIL.def_flag(argv.clean, '--clean'));
, def_flag(argv.clean, '--clean'));
};
19 changes: 11 additions & 8 deletions cmds/core/concat.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,12 @@

"use strict";

exports.command = ['concat [names..]', 'concatenate [names..]'];
exports.desc = UTIL.hide_cmd('Concatenate elisp files');
exports.builder = yargs => yargs
import { TITLE_CMD_OPTION } from "../../src/env.js";
import { e_call, hide_cmd, def_flag } from '../../src/util.js';

export const command = ['concat [names..]', 'concatenate [names..]'];
export const desc = hide_cmd('Concatenate elisp files');
export const builder = yargs => yargs
.positional(
'[names..]', {
description: 'specify files to concatenate',
Expand All @@ -41,9 +44,9 @@ exports.builder = yargs => yargs
},
});

exports.handler = async (argv) => {
await UTIL.e_call(argv, 'core/concat'
, argv.names
, UTIL.def_flag(argv.dest, '--dest', argv.dest)
, UTIL.def_flag(argv.output, '--output', argv.output));
export const handler = async (argv) => {
await e_call(argv, 'core/concat'
, argv.names
, def_flag(argv.dest, '--dest', argv.dest)
, def_flag(argv.output, '--output', argv.output));
};
19 changes: 12 additions & 7 deletions cmds/core/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,27 @@

"use strict";

exports.command = ['create <type>'];
exports.desc = 'Create a new elisp project';
exports.builder = function (yargs) {
yargs.usage(`${exports.desc}
import path from 'path';
import { cmd_count } from '../../src/util.js';

const __dirname = import.meta.dirname;

export const command = ['create <type>'];
export const desc = 'Create a new elisp project';
export const builder = function (yargs) {
yargs.usage(`${desc}

Usage: eask create <type> [options..]`)
.commandDir('../create/')
.commandDir(path.join(__dirname, '../create/'))
.demandCommand();

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

exports.handler = async (argv) => { };
export const handler = async (argv) => { };
19 changes: 10 additions & 9 deletions cmds/core/docker.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@

"use strict";

const path = require('path');
const child_process = require("child_process");
import path from 'path';
import child_process from "child_process";
import { which, cli_args, slash } from '../../src/util.js';

exports.command = ['docker <version> [args..]'];
exports.desc = 'Launch specified Emacs version in a Docker container';
exports.builder = async (yargs) => {
export const command = ['docker <version> [args..]'];
export const desc = 'Launch specified Emacs version in a Docker container';
export const builder = async (yargs) => {
yargs.help(false);
yargs.version(false);
yargs.getOptions().narg = [];
Expand All @@ -33,8 +34,8 @@ exports.builder = async (yargs) => {
});
};

exports.handler = async (argv) => {
if (!UTIL.which('docker')) {
export const handler = async (argv) => {
if (!which('docker')) {
console.warn("Docker is not installed (cannot find `docker' executable)");
return;
}
Expand Down Expand Up @@ -67,7 +68,7 @@ exports.handler = async (argv) => {

let cmd = default_cmd.concat(rest);

let proc = child_process.spawn(UTIL.cli_args(cmd), { stdio: 'inherit', shell: true });
let proc = child_process.spawn(cli_args(cmd), { stdio: 'inherit', shell: true });

proc.on('close', function (code) {
if (code == 0) return;
Expand All @@ -80,7 +81,7 @@ exports.handler = async (argv) => {
* @param { String } path - Path to convert.
*/
function convert_path(path) {
return UTIL.slash(path).replaceAll(':', '');
return slash(path).replaceAll(':', '');
}

/**
Expand Down
Loading
Loading