diff --git a/README.md b/README.md index 97a4097..dd5569b 100644 --- a/README.md +++ b/README.md @@ -5,8 +5,7 @@ ![GitHub release](https://img.shields.io/github/release/yamajyn/commandlist.svg?style=flat) ![License](https://img.shields.io/badge/license-MIT-blue.svg?style=flat) -![commandlist](resources/dark/icon.svg) -![commandlist](resources/light/icon.svg) +![commandlist](resources/icon@64.svg) Run and Save commands in WorkSpace or Global @@ -17,23 +16,21 @@ Run and Save commands in WorkSpace or Global ## Extension Settings -Include if your extension adds any VS Code settings through the `contributes.configuration` extension point. - -For example: This extension contributes the following settings: -* `myExtension.enable`: enable/disable this extension -* `myExtension.thing`: set to `blah` to do something +* `commandList.enable`: enable/disable this extension ## Release Notes -Users appreciate release notes as you update your extension. - ### 1.0.0 Initial release of commandlist +### 0.1.0 + +create Command explorer and command executer. + ----------------------------------------------------------------------------------------------------------- ## Changelog diff --git a/resources/icon@64.svg b/resources/icon@64.svg new file mode 100644 index 0000000..77c85c3 --- /dev/null +++ b/resources/icon@64.svg @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff --git a/src/commandExplorer.ts b/src/commandExplorer.ts index 866375c..a3442a4 100644 --- a/src/commandExplorer.ts +++ b/src/commandExplorer.ts @@ -220,7 +220,7 @@ export class FileSystemProvider implements vscode.TreeDataProvider, vscod return { dispose: () => watcher.close() }; } - stat(uri: vscode.Uri): vscode.FileStat | Thenable { + stat(uri: vscode.Uri): Thenable { return this._stat(uri.fsPath); } @@ -228,7 +228,7 @@ export class FileSystemProvider implements vscode.TreeDataProvider, vscod return new FileStat(await _.stat(path)); } - readDirectory(uri: vscode.Uri): [string, vscode.FileType][] | Thenable<[string, vscode.FileType][]> { + readDirectory(uri: vscode.Uri): Thenable<[string, vscode.FileType][]> { return this._readDirectory(uri); } @@ -245,7 +245,7 @@ export class FileSystemProvider implements vscode.TreeDataProvider, vscod return Promise.resolve(result); } - createDirectory(uri: vscode.Uri): void | Thenable { + createDirectory(uri: vscode.Uri): Thenable { return _.mkdir(uri.fsPath); } @@ -253,7 +253,7 @@ export class FileSystemProvider implements vscode.TreeDataProvider, vscod return _.readfile(uri.fsPath); } - writeFile(uri: vscode.Uri, content: Uint8Array, options: { create: boolean; overwrite: boolean; }): void | Thenable { + writeFile(uri: vscode.Uri, content: Uint8Array, options: { create: boolean; overwrite: boolean; }): Thenable { return this._writeFile(uri.fsPath, content, options); } @@ -278,7 +278,7 @@ export class FileSystemProvider implements vscode.TreeDataProvider, vscod return Uint8Array.from(Buffer.from(s)); } - delete(uri: vscode.Uri, options: { recursive: boolean; }): void | Thenable { + delete(uri: vscode.Uri, options: { recursive: boolean; }): Thenable { if (options.recursive) { return _.rmrf(uri.fsPath); } @@ -286,7 +286,7 @@ export class FileSystemProvider implements vscode.TreeDataProvider, vscod return _.unlink(uri.fsPath); } - rename(oldUri: vscode.Uri, newUri: vscode.Uri, options: { overwrite: boolean; }): void | Thenable { + rename(oldUri: vscode.Uri, newUri: vscode.Uri, options: { overwrite: boolean; }): Thenable { return this._rename(oldUri, newUri, options); } diff --git a/src/test/commandExplorer.test.ts b/src/test/commandExplorer.test.ts index 6040cda..52a4a42 100644 --- a/src/test/commandExplorer.test.ts +++ b/src/test/commandExplorer.test.ts @@ -13,30 +13,30 @@ export const commandExplorerTest = () => { const dir = vscode.Uri.file(__dirname + "/testdir"); test("createDirectory", () => { - provider.createDirectory(dir); - provider.isExists(dir.fsPath).then(result => { - assert.equal(true, result); - }); + return provider.createDirectory(dir).then(_ => { + return provider.isExists(dir.fsPath); + }).then(result => { + assert.equal(true, result); + }); + }); const file = vscode.Uri.file(__dirname + "/testdir/test.json"); const testJSON: Command = { - script: "ls -a" + script: 'ls -a' }; test("writeFile", () => { const content = provider.stringToUnit8Array(JSON.stringify(testJSON)); - assert.ok(provider.writeFile(file, content, { create: true, overwrite: true })); - }); - - test('isExists', () => { - provider.isExists(file.fsPath).then(result => { + return provider.writeFile(file, content, { create: true, overwrite: true }).then(_ => { + return provider.isExists(file.fsPath); + }).then(result => { assert.equal(true, result); }); }); test('readFile', () => { - provider.readFile(file).then(result => { - assert.equal(testJSON, result.toString()); + return provider.readFile(file).then(result => { + assert.equal(JSON.stringify(testJSON), result.toString()); }); }); @@ -45,7 +45,11 @@ export const commandExplorerTest = () => { }); test('deleteFile', () => { - provider.delete(dir, { recursive : true }); + return provider.delete(dir, { recursive : true }).then( _ => { + return provider.isExists(file.fsPath); + }).then(result => { + assert.equal(false, result); + }); }); }); };