mirror of
https://github.com/denoland/deno.git
synced 2024-12-23 15:49:44 -05:00
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.
This commit is contained in:
parent
ff5bba3be8
commit
a3c3a56ff7
4 changed files with 15 additions and 16 deletions
|
@ -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";
|
||||
|
|
13
cli/js/lib.deno.ns.d.ts
vendored
13
cli/js/lib.deno.ns.d.ts
vendored
|
@ -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
|
||||
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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 });
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue