[shelljs] Add missing chmod types (#25332)

This commit is contained in:
George Kalpakas
2018-04-27 23:24:39 -07:00
committed by Wesley Wigham
parent a484c88872
commit 1462bc999b
2 changed files with 23 additions and 0 deletions
+21
View File
@@ -2,6 +2,7 @@
// Project: http://shelljs.org
// Definitions by: Niklas Mollenhauer <https://github.com/nikeee>
// Vojtech Jasny <https://github.com/voy>
// George Kalpakas <https://github.com/gkalpak>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node"/>
@@ -381,6 +382,16 @@ export type ShellArray = string[] & ShellReturnValue;
*/
export function chmod(octalMode: number, file: string): void;
/**
* Alters the permissions of a file or directory by either specifying the absolute permissions in octal form or expressing the changes in symbols. This command tries to mimic the POSIX behavior as much as possible. Notable exceptions:
* - In symbolic modes, 'a-r' and '-r' are identical. No consideration is given to the umask.
* - There is no "quiet" option since default behavior is to run silent.
* @param options Available options: -v (output a diagnostic for every file processed), -c (like -v but report only when a change is made), -R (change files and directories recursively)
* @param octalMode The access mode. Octal.
* @param file The file to use.
*/
export function chmod(options: string, octalMode: number, file: string): void;
/**
* Alters the permissions of a file or directory by either specifying the absolute permissions in octal form or expressing the changes in symbols. This command tries to mimic the POSIX behavior as much as possible. Notable exceptions:
* - In symbolic modes, 'a-r' and '-r' are identical. No consideration is given to the umask.
@@ -390,6 +401,16 @@ export function chmod(octalMode: number, file: string): void;
*/
export function chmod(mode: string, file: string): void;
/**
* Alters the permissions of a file or directory by either specifying the absolute permissions in octal form or expressing the changes in symbols. This command tries to mimic the POSIX behavior as much as possible. Notable exceptions:
* - In symbolic modes, 'a-r' and '-r' are identical. No consideration is given to the umask.
* - There is no "quiet" option since default behavior is to run silent.
* @param options Available options: -v (output a diagnostic for every file processed), -c (like -v but report only when a change is made), -R (change files and directories recursively)
* @param mode The access mode. Can be an octal string or a symbolic mode string.
* @param file The file to use.
*/
export function chmod(options: string, mode: string, file: string): void;
// Non-Unix commands
/**
+2
View File
@@ -116,6 +116,8 @@ shell.set('-f');
shell.chmod(755, "/Users/brandon");
shell.chmod("755", "/Users/brandon"); // same as above
shell.chmod("u+x", "/Users/brandon");
shell.chmod("-cR", 755, "/Users/brandon");
shell.chmod("-Rv", "u+x", "/Users/brandon");
shell.exit(0);