diff options
author | dubiousjim <dubiousjim@gmail.com> | 2020-03-02 15:24:42 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-02 21:24:42 +0100 |
commit | a3c3a56ff71c325ea4807548484023c95ffdcd77 (patch) | |
tree | b86091ab954429ed538222957c08588aa3718a97 /cli/js | |
parent | ff5bba3be833b0062b3991b96272c0047c18b62e (diff) |
Rename Option -> Options (#4226)
* Rename MkdirOption interface to MkdirOptions
It was hard to remember which Options interfaces were spelled in the
singular and which in the plural (and anyway this one contained two
options).
Also added MkdirOptions to cli/js/deno.ts. All the analogous interfaces
were exported there.
* Rename RemoveOption interface to RemoveOptions
This was the last remaining Option interface spelled in the singular.
Easier to remember if they're all Option**s**; plus we may want to add extra
options here later.
Diffstat (limited to 'cli/js')
-rw-r--r-- | cli/js/deno.ts | 4 | ||||
-rw-r--r-- | cli/js/lib.deno.ns.d.ts | 13 | ||||
-rw-r--r-- | cli/js/mkdir.ts | 8 | ||||
-rw-r--r-- | cli/js/remove.ts | 6 |
4 files changed, 15 insertions, 16 deletions
diff --git a/cli/js/deno.ts b/cli/js/deno.ts index c563d5112..ab1144496 100644 --- a/cli/js/deno.ts +++ b/cli/js/deno.ts @@ -73,7 +73,7 @@ export { MakeTempOptions } from "./make_temp.ts"; export { metrics, Metrics } from "./metrics.ts"; -export { mkdirSync, mkdir } from "./mkdir.ts"; +export { mkdirSync, mkdir, MkdirOptions } from "./mkdir.ts"; export { Addr, connect, @@ -115,7 +115,7 @@ export { readDirSync, readDir } from "./read_dir.ts"; export { readFileSync, readFile } from "./read_file.ts"; export { readlinkSync, readlink } from "./read_link.ts"; export { realpathSync, realpath } from "./realpath.ts"; -export { removeSync, remove, RemoveOption } from "./remove.ts"; +export { removeSync, remove, RemoveOptions } from "./remove.ts"; export { renameSync, rename } from "./rename.ts"; export { resources } from "./resources.ts"; export { signal, signals, SignalStream } from "./signals.ts"; diff --git a/cli/js/lib.deno.ns.d.ts b/cli/js/lib.deno.ns.d.ts index 55cca78cf..4a13bafb6 100644 --- a/cli/js/lib.deno.ns.d.ts +++ b/cli/js/lib.deno.ns.d.ts @@ -721,7 +721,7 @@ declare namespace Deno { // @url js/mkdir.d.ts - export interface MkdirOption { + export interface MkdirOptions { /** Defaults to `false`. If set to `true`, means that any intermediate * directories will also be created (as with the shell command `mkdir -p`). * Intermediate directories are created with the same permissions. @@ -740,7 +740,7 @@ declare namespace Deno { * Deno.mkdirSync("nested/directories", { recursive: true }); * * Requires `allow-write` permission. */ - export function mkdirSync(path: string, options?: MkdirOption): void; + export function mkdirSync(path: string, options?: MkdirOptions): void; /** @deprecated */ export function mkdirSync( @@ -755,7 +755,7 @@ declare namespace Deno { * await Deno.mkdir("nested/directories", { recursive: true }); * * Requires `allow-write` permission. */ - export function mkdir(path: string, options?: MkdirOption): Promise<void>; + export function mkdir(path: string, options?: MkdirOptions): Promise<void>; /** @deprecated */ export function mkdir( @@ -920,8 +920,7 @@ declare namespace Deno { // @url js/remove.d.ts - /** UNSTABLE: rename to RemoveOptions */ - export interface RemoveOption { + export interface RemoveOptions { /** Defaults to `false`. If set to `true`, path will be removed even if * it's a non-empty directory. */ recursive?: boolean; @@ -934,7 +933,7 @@ declare namespace Deno { * Deno.removeSync("/path/to/dir/or/file", { recursive: false }); * * Requires `allow-write` permission. */ - export function removeSync(path: string, options?: RemoveOption): void; + export function removeSync(path: string, options?: RemoveOptions): void; /** Removes the named file or directory. Throws error if permission denied, * path not found, or path is a non-empty directory and the `recursive` @@ -943,7 +942,7 @@ declare namespace Deno { * await Deno.remove("/path/to/dir/or/file", { recursive: false }); * * Requires `allow-write` permission. */ - export function remove(path: string, options?: RemoveOption): Promise<void>; + export function remove(path: string, options?: RemoveOptions): Promise<void>; // @url js/rename.d.ts diff --git a/cli/js/mkdir.ts b/cli/js/mkdir.ts index ecb15a9c5..4d15d9a44 100644 --- a/cli/js/mkdir.ts +++ b/cli/js/mkdir.ts @@ -5,7 +5,7 @@ import { sendSync, sendAsync } from "./dispatch_json.ts"; // mkdir and mkdirSync. function mkdirArgs( path: string, - optionsOrRecursive?: MkdirOption | boolean, + optionsOrRecursive?: MkdirOptions | boolean, mode?: number ): { path: string; recursive: boolean; mode: number } { const args = { path, recursive: false, mode: 0o777 }; @@ -25,7 +25,7 @@ function mkdirArgs( return args; } -export interface MkdirOption { +export interface MkdirOptions { /** Defaults to `false`. If set to `true`, means that any intermediate * directories will also be created (as with the shell command `mkdir -p`). * Intermediate directories are created with the same permissions. @@ -46,7 +46,7 @@ export interface MkdirOption { * Requires `allow-write` permission. */ export function mkdirSync( path: string, - optionsOrRecursive?: MkdirOption | boolean, + optionsOrRecursive?: MkdirOptions | boolean, mode?: number ): void { sendSync("op_mkdir", mkdirArgs(path, optionsOrRecursive, mode)); @@ -60,7 +60,7 @@ export function mkdirSync( * Requires `allow-write` permission. */ export async function mkdir( path: string, - optionsOrRecursive?: MkdirOption | boolean, + optionsOrRecursive?: MkdirOptions | boolean, mode?: number ): Promise<void> { await sendAsync("op_mkdir", mkdirArgs(path, optionsOrRecursive, mode)); diff --git a/cli/js/remove.ts b/cli/js/remove.ts index 4d15cf241..89e5850ab 100644 --- a/cli/js/remove.ts +++ b/cli/js/remove.ts @@ -1,7 +1,7 @@ // Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. import { sendSync, sendAsync } from "./dispatch_json.ts"; -export interface RemoveOption { +export interface RemoveOptions { /** Defaults to `false`. If set to `true`, path will be removed even if * it's a non-empty directory. */ recursive?: boolean; @@ -14,7 +14,7 @@ export interface RemoveOption { * Deno.removeSync("/path/to/dir/or/file", { recursive: false }); * * Requires `allow-write` permission. */ -export function removeSync(path: string, options: RemoveOption = {}): void { +export function removeSync(path: string, options: RemoveOptions = {}): void { sendSync("op_remove", { path, recursive: !!options.recursive }); } @@ -27,7 +27,7 @@ export function removeSync(path: string, options: RemoveOption = {}): void { * Requires `allow-write` permission. */ export async function remove( path: string, - options: RemoveOption = {} + options: RemoveOptions = {} ): Promise<void> { await sendAsync("op_remove", { path, recursive: !!options.recursive }); } |