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
13 changes: 7 additions & 6 deletions bin/integration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import * as fs from 'node:fs';
import * as Path from 'node:path';
import { glob } from 'glob';
import { zip } from 'ix/iterable/zip';
import commandLineArgs from 'command-line-args';
import { parseCliArgs, formatUsage } from '../src/bin/cli.ts';
import { parseArrowJSON } from '../src/util/json.ts';

import {
Expand All @@ -35,7 +35,7 @@ import {
} from '../index.ts';

const { createElementComparator } = util;
const argv = commandLineArgs(cliOpts(), { partial: true });
const { values: argv, positionals } = parseCliArgs(cliOpts(), process.argv.slice(2));

const exists = async (p: string) => {
try {
Expand All @@ -47,9 +47,9 @@ const exists = async (p: string) => {

if (!argv.mode) { return print_usage(); }

const mode = argv.mode.toUpperCase();
let jsonPaths = [...(argv.json || [])];
let arrowPaths = [...(argv.arrow || [])];
const mode = (argv.mode as string).toUpperCase();
let jsonPaths = [...(argv.json as string[] | undefined ?? [])];
let arrowPaths = [...(argv.arrow as string[] | undefined ?? [])];

if (mode === 'VALIDATE' && jsonPaths.length === 0) {
[jsonPaths, arrowPaths] = await loadLocalJSONAndArrowPathsForDebugging(jsonPaths, arrowPaths);
Expand Down Expand Up @@ -104,7 +104,7 @@ function cliOpts() {
}

function print_usage() {
console.log(require('command-line-usage')([
console.log(formatUsage([
{
header: 'integration',
content: 'Script for running Arrow integration tests'
Expand All @@ -121,6 +121,7 @@ function print_usage() {
...cliOpts(),
{
name: 'help',
type: Boolean,
description: 'Print this usage guide.'
}
]
Expand Down
11 changes: 6 additions & 5 deletions bin/json-to-arrow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@

import * as fs from 'node:fs';
import * as Path from 'node:path';
import commandLineArgs from 'command-line-args';
import { parseCliArgs, formatUsage } from '../src/bin/cli.ts';
import { finished as eos } from 'node:stream/promises';
import { parseArrowJSON } from '../src/util/json.ts';
import { RecordBatchReader, RecordBatchFileWriter, RecordBatchStreamWriter } from '../index.ts';

const argv = commandLineArgs(cliOpts(), { partial: true });
const jsonPaths = [...(argv.json || [])];
const arrowPaths = [...(argv.arrow || [])];
const { values: argv } = parseCliArgs(cliOpts(), process.argv.slice(2));
const jsonPaths = [...(argv.json as string[] | undefined ?? [])];
const arrowPaths = [...(argv.arrow as string[] | undefined ?? [])];

(async () => {

Expand Down Expand Up @@ -81,7 +81,7 @@ function cliOpts() {
}

function print_usage() {
console.log(require('command-line-usage')([
console.log(formatUsage([
{
header: 'json-to-arrow',
content: 'Script for converting a JSON Arrow file to a binary Arrow file'
Expand All @@ -98,6 +98,7 @@ function print_usage() {
...cliOpts(),
{
name: 'help',
type: Boolean,
description: 'Print this usage guide.'
}
]
Expand Down
36 changes: 25 additions & 11 deletions gulp/argv.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,32 @@
// specific language governing permissions and limitations
// under the License.

import args from 'command-line-args';
export const argv = args([
{ name: `all`, type: Boolean },
{ name: 'verbose', alias: `v`, type: Boolean },
{ name: `target`, type: String, defaultValue: `` },
{ name: `module`, type: String, defaultValue: `` },
{ name: `coverage`, type: Boolean, defaultValue: false },
{ name: `tests`, type: String, multiple: true, defaultValue: [`test/unit/`] },
{ name: `targets`, alias: `t`, type: String, multiple: true, defaultValue: [] },
{ name: `modules`, alias: `m`, type: String, multiple: true, defaultValue: [] },
], { partial: true });
import { parseArgs } from 'node:util';

const { values, tokens } = parseArgs({
options: {
all: { type: 'boolean' },
verbose: { type: 'boolean', short: 'v' },
target: { type: 'string', default: '' },
module: { type: 'string', default: '' },
coverage: { type: 'boolean', default: false },
tests: { type: 'string', multiple: true, default: ['test/unit/'] },
targets: { type: 'string', short: 't', multiple: true, default: [] },
modules: { type: 'string', short: 'm', multiple: true, default: [] },
},
args: process.argv.slice(2),
strict: false,
allowPositionals: true,
tokens: true,
});

// Expose unknown/positional tokens under `_unknown` for compatibility with
// the previous command-line-args partial mode used by gulp/test-task.js.
values._unknown = tokens
.filter((t) => t.kind === 'positional')
.map((t) => t.value);
Comment on lines +18 to +41
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@maorleger is the AI correct about this?


export const argv = values;
export const { targets, modules } = argv;

if (argv.target === `src`) {
Expand Down
141 changes: 8 additions & 133 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading