UNPKG

shell-ahk

Version:

`Lodash`/`jQuery` for `AHK`.

42 lines (32 loc) 1.1 kB
# @ts-check import fileShell_replace from './replace' import fileShell_noop from './noop' class FileShell ###* @type import('./fileShell').Constructor ### constructor: (source) -> ###* @type import('./fileShell').FileShell['source'] ### @source = source ###* @type import('./fileShell').FileShell['append'] ### append: (content) -> fileShell_noop content Native 'FileAppend, % content, % this.source, UTF-8' return ###* @type import('./fileShell').FileShell['isExists'] ### isExists: -> FileExist @source ###* @type import('./fileShell').FileShell['read'] ### read: -> unless @isExists() then return '' fileShell_result = '' Native 'FileRead, fileShell_result, % this.source' return fileShell_replace fileShell_result, '\r', '' ###* @type import('./fileShell').FileShell['remove'] ### remove: -> unless @isExists() then return Native 'FileDelete, % this.source' return ###* @type import('./fileShell').FileShell['write'] ### write: (content) -> @remove() @append content return fileShell_noop FileShell