Skip to content

Commit

Permalink
chore(deno): upgrade to deno v0.41.0
Browse files Browse the repository at this point in the history
  • Loading branch information
c4spar committed Apr 18, 2020
1 parent fcf1402 commit 83c767c
Show file tree
Hide file tree
Showing 15 changed files with 55 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Expand Up @@ -10,7 +10,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]
deno_version: ['v0.38.0', 'v0.39.0', 'v0.40.0']
deno_version: ['v0.39.0', 'v0.40.0', 'v0.41.0']

steps:
- name: Configure git
Expand Down
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -4,7 +4,7 @@ A collection of modules for creating interactive command line tools.

![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/c4spar/deno-cliffy?logo=github) ![GitHub Release Date](https://img.shields.io/github/release-date/c4spar/deno-cliffy?logo=github)

![Build Status](https://github.com/c4spar/deno-cliffy/workflows/ci/badge.svg?branch=master) ![Deno version](https://img.shields.io/badge/deno-v0.40.0|v0.39.0|v0.38.0-green?logo=deno) ![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/c4spar/deno-cliffy?logo=github) ![GitHub issues](https://img.shields.io/github/issues/c4spar/deno-cliffy?logo=github) ![GitHub licence](https://img.shields.io/github/license/c4spar/deno-cliffy?logo=github)
![Build Status](https://github.com/c4spar/deno-cliffy/workflows/ci/badge.svg?branch=master) ![Deno version](https://img.shields.io/badge/deno-v0.41.0|v0.40.0|v0.39.0-green?logo=deno) ![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/c4spar/deno-cliffy?logo=github) ![GitHub issues](https://img.shields.io/github/issues/c4spar/deno-cliffy?logo=github) ![GitHub licence](https://img.shields.io/github/license/c4spar/deno-cliffy?logo=github)

**Included modules:**

Expand Down
2 changes: 1 addition & 1 deletion packages/command/README.md
Expand Up @@ -6,7 +6,7 @@ The complete solution for [Deno](https://deno.land/) command-line interfaces, in

![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/c4spar/deno-cliffy?logo=github) ![GitHub Release Date](https://img.shields.io/github/release-date/c4spar/deno-cliffy?logo=github)

![Build Status](https://github.com/c4spar/deno-cliffy/workflows/ci/badge.svg?branch=master) ![Deno version](https://img.shields.io/badge/deno-v0.40.0|v0.39.0|v0.38.0-green?logo=deno) ![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/c4spar/deno-cliffy?logo=github) ![GitHub issues](https://img.shields.io/github/issues/c4spar/deno-cliffy?logo=github) ![GitHub licence](https://img.shields.io/github/license/c4spar/deno-cliffy?logo=github)
![Build Status](https://github.com/c4spar/deno-cliffy/workflows/ci/badge.svg?branch=master) ![Deno version](https://img.shields.io/badge/deno-v0.41.0|v0.40.0|v0.39.0-green?logo=deno) ![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/c4spar/deno-cliffy?logo=github) ![GitHub issues](https://img.shields.io/github/issues/c4spar/deno-cliffy?logo=github) ![GitHub licence](https://img.shields.io/github/license/c4spar/deno-cliffy?logo=github)

### ✨ Features

Expand Down
2 changes: 1 addition & 1 deletion packages/command/commands/completions.ts
@@ -1,4 +1,4 @@
import { bold, dim, italic } from 'https://deno.land/std@v0.40.0/fmt/colors.ts';
import { bold, dim, italic } from 'https://deno.land/std@v0.41.0/fmt/colors.ts';
import { BaseCommand } from '../lib/base-command.ts';
import { DefaultCommand } from '../lib/default-command.ts';
import { BashCompletionsCommand } from './completions/bash.ts';
Expand Down
2 changes: 1 addition & 1 deletion packages/command/commands/help.ts
@@ -1,4 +1,4 @@
import { blue, bold, dim, green, magenta, red, yellow } from 'https://deno.land/std@v0.40.0/fmt/colors.ts';
import { blue, bold, dim, green, magenta, red, yellow } from 'https://deno.land/std@v0.41.0/fmt/colors.ts';
import { IFlagOptions, IFlags } from '../../flags/lib/types.ts';
import { Table } from '../../table/lib/table.ts';
import format from '../../x/format.ts';
Expand Down
39 changes: 37 additions & 2 deletions packages/command/lib/base-command.ts
@@ -1,6 +1,6 @@
const { stdout, stderr } = Deno;
import { encode } from 'https://deno.land/std@v0.40.0/encoding/utf8.ts';
import { dim, red } from 'https://deno.land/std@v0.40.0/fmt/colors.ts';
import { encode } from 'https://deno.land/std@v0.41.0/encoding/utf8.ts';
import { dim, red } from 'https://deno.land/std@v0.41.0/fmt/colors.ts';
import { parseFlags } from '../../flags/lib/flags.ts';
import { IFlagArgument, IFlagOptions, IFlags, IFlagsResult, IFlagValue, IFlagValueHandler, IFlagValueType, IGenericObject, ITypeHandler, OptionType } from '../../flags/lib/types.ts';
import { fill } from '../../flags/lib/utils.ts';
Expand Down Expand Up @@ -96,13 +96,32 @@ export class BaseCommand {
subCommand.arguments( result.typeDefinition );
}

// if ( name === '*' && !subCommand.isExecutable ) {
// subCommand.isExecutable = true;
// }

this.commands.set( name, { name, cmd: subCommand, aliases } );

this.select( name );

return this;
}

// public static async exists( name: string ) {
//
// const proc = Deno.run( {
// cmd: [ 'sh', '-c', 'compgen -c' ],
// stdout: 'piped',
// stderr: 'piped'
// } );
// const output: Uint8Array = await proc.output();
// const commands = new TextDecoder().decode( output )
// .trim()
// .split( '\n' );
//
// return commands.indexOf( name ) !== -1;
// }

/**
* Add new command alias.
*
Expand Down Expand Up @@ -510,6 +529,7 @@ export class BaseCommand {
const executable = names.join( '-' );

try {
// @TODO: create getEnv() method which should return all known environment variables and pass it to Deno.run({env})
await Deno.run( {
cmd: [ executable, ...args ]
} );
Expand Down Expand Up @@ -591,6 +611,20 @@ export class BaseCommand {
*/
protected splitArguments( args: string ) {

// const parts = args.trim().split( /[,<\[]/g ).map( ( arg: string ) => arg.trim() );
// const typeParts: string[] = [];
//
// while ( parts[ parts.length - 1 ] && parts[ parts.length - 1 ].match( /[\]>]$/ ) ) {
// let arg = parts.pop() as string;
// const lastPart = arg.slice( 0, -1 );
// arg = lastPart === ']' ? `[${ arg }` : `<${ arg }`;
// typeParts.unshift( arg );
// }
//
// const typeDefinition: string | undefined = typeParts.join( ' ' ) || undefined;
//
// return { args: parts, typeDefinition };

const parts = args.trim().split( /[, =] */g );
const typeParts = [];

Expand Down Expand Up @@ -944,6 +978,7 @@ export class BaseCommand {
public getCommandMap( name: string ): CommandMap {

const cmd: CommandMap | undefined = this.commands.get( name );
// || this.commands.get( '*' );

if ( !cmd ) {
throw this.error( new Error( `Sub-command not found: ${ name }` ) );
Expand Down
5 changes: 5 additions & 0 deletions packages/command/lib/default-command.ts
Expand Up @@ -32,6 +32,11 @@ export class DefaultCommand extends BaseCommand {
}
} )

// .option( '-v, --verbose [arg:number]', 'Increase debug output.', {
// collect: true,
// value: ( val: boolean, prev: number = 0 ) => val ? prev + 1 : prev - 1
// } )

.command( 'help', new HelpCommand( this ) )

.reset();
Expand Down
2 changes: 1 addition & 1 deletion packages/command/test/lib/assert.ts
Expand Up @@ -4,4 +4,4 @@ export {
assertStrictEq,
assertThrows,
assertThrowsAsync
} from 'https://deno.land/std@v0.40.0/testing/asserts.ts';
} from 'https://deno.land/std@v0.41.0/testing/asserts.ts';
2 changes: 1 addition & 1 deletion packages/flags/README.md
Expand Up @@ -4,7 +4,7 @@ Command line parser for [Deno](https://deno.land/) and used by cliffy's [command

![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/c4spar/deno-cliffy?logo=github) ![GitHub Release Date](https://img.shields.io/github/release-date/c4spar/deno-cliffy?logo=github)

![Build Status](https://github.com/c4spar/deno-cliffy/workflows/ci/badge.svg?branch=master) ![Deno version](https://img.shields.io/badge/deno-v0.40.0|v0.39.0|v0.38.0-green?logo=deno) ![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/c4spar/deno-cliffy?logo=github) ![GitHub issues](https://img.shields.io/github/issues/c4spar/deno-cliffy?logo=github) ![GitHub licence](https://img.shields.io/github/license/c4spar/deno-cliffy?logo=github)
![Build Status](https://github.com/c4spar/deno-cliffy/workflows/ci/badge.svg?branch=master) ![Deno version](https://img.shields.io/badge/deno-v0.41.0|v0.40.0|v0.39.0-green?logo=deno) ![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/c4spar/deno-cliffy?logo=github) ![GitHub issues](https://img.shields.io/github/issues/c4spar/deno-cliffy?logo=github) ![GitHub licence](https://img.shields.io/github/license/c4spar/deno-cliffy?logo=github)

## License

Expand Down
2 changes: 1 addition & 1 deletion packages/flags/test/lib/assert.ts
Expand Up @@ -4,4 +4,4 @@ export {
assertStrictEq,
assertThrows,
assertThrowsAsync
} from 'https://deno.land/std@v0.40.0/testing/asserts.ts';
} from 'https://deno.land/std@v0.41.0/testing/asserts.ts';
2 changes: 1 addition & 1 deletion packages/keycode/README.md
Expand Up @@ -4,7 +4,7 @@ ANSI key code parser for [Deno](https://deno.land/). Used by cliffy's [prompt](.

![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/c4spar/deno-cliffy?logo=github) ![GitHub Release Date](https://img.shields.io/github/release-date/c4spar/deno-cliffy?logo=github)

![Build Status](https://github.com/c4spar/deno-cliffy/workflows/ci/badge.svg?branch=master) ![Deno version](https://img.shields.io/badge/deno-v0.40.0|v0.39.0|v0.38.0-green?logo=deno) ![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/c4spar/deno-cliffy?logo=github) ![GitHub issues](https://img.shields.io/github/issues/c4spar/deno-cliffy?logo=github) ![GitHub licence](https://img.shields.io/github/license/c4spar/deno-cliffy?logo=github)
![Build Status](https://github.com/c4spar/deno-cliffy/workflows/ci/badge.svg?branch=master) ![Deno version](https://img.shields.io/badge/deno-v0.41.0|v0.40.0|v0.39.0-green?logo=deno) ![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/c4spar/deno-cliffy?logo=github) ![GitHub issues](https://img.shields.io/github/issues/c4spar/deno-cliffy?logo=github) ![GitHub licence](https://img.shields.io/github/license/c4spar/deno-cliffy?logo=github)

## Example

Expand Down
2 changes: 1 addition & 1 deletion packages/keycode/lib/key-code.ts
@@ -1,4 +1,4 @@
import { decode } from 'https://deno.land/std@v0.40.0/encoding/utf8.ts';
import { decode } from 'https://deno.land/std@v0.41.0/encoding/utf8.ts';
import { KeyMap, KeyMapCtrl, KeyMapShift } from './key-codes.ts';
import { IKey, KeyEvent } from './key-event.ts';

Expand Down
2 changes: 1 addition & 1 deletion packages/keycode/test/lib/assert.ts
Expand Up @@ -4,4 +4,4 @@ export {
assertStrictEq,
assertThrows,
assertThrowsAsync
} from 'https://deno.land/std@v0.40.0/testing/asserts.ts';
} from 'https://deno.land/std@v0.41.0/testing/asserts.ts';
2 changes: 1 addition & 1 deletion packages/table/lib/table.ts
@@ -1,4 +1,4 @@
import { encode } from 'https://deno.land/std@v0.40.0/encoding/utf8.ts';
import { encode } from 'https://deno.land/std@v0.41.0/encoding/utf8.ts';
import { border } from './border.ts';
import { Cell, ICell } from './cell.ts';
import { CELL_PADDING, MAX_CELL_WIDTH, MIN_CELL_WIDTH } from './const.ts';
Expand Down
2 changes: 1 addition & 1 deletion packages/table/test/lib/assert.ts
Expand Up @@ -4,4 +4,4 @@ export {
assertStrictEq,
assertThrows,
assertThrowsAsync
} from 'https://deno.land/std@v0.40.0/testing/asserts.ts';
} from 'https://deno.land/std@v0.41.0/testing/asserts.ts';

0 comments on commit 83c767c

Please sign in to comment.