diff --git a/types/shelljs/index.d.ts b/types/shelljs/index.d.ts index 54bd3e8f9a..601668f65f 100644 --- a/types/shelljs/index.d.ts +++ b/types/shelljs/index.d.ts @@ -2,6 +2,7 @@ // Project: http://shelljs.org // Definitions by: Niklas Mollenhauer // Vojtech Jasny +// George Kalpakas // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -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 /** diff --git a/types/shelljs/shelljs-tests.ts b/types/shelljs/shelljs-tests.ts index f098e76f7a..da3175f5c6 100644 --- a/types/shelljs/shelljs-tests.ts +++ b/types/shelljs/shelljs-tests.ts @@ -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);