-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
stub projectfile, punchfile, and punch command
- Loading branch information
Showing
6 changed files
with
113 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
export async function executeShellCommandAsync(command: string, args: string[]): Promise<ShellOutput> { | ||
const output = await new Deno.Command(command, { args: args }).output(); | ||
return new ShellOutput(output); | ||
} | ||
|
||
export class ShellOutput { | ||
private _output: Deno.CommandOutput; | ||
|
||
constructor(output: Deno.CommandOutput) { | ||
this._output = output; | ||
} | ||
|
||
public get code(): number { | ||
return this._output.code; | ||
} | ||
|
||
public get stderr(): string { | ||
return new TextDecoder().decode(this._output.stderr); | ||
} | ||
|
||
public get stdout(): string { | ||
return new TextDecoder().decode(this._output.stdout); | ||
} | ||
|
||
public verifyZeroReturnCode(): ShellOutput { | ||
if (this._output.code !== 0) { | ||
// todo - enhance error handling | ||
console.log(this.stdout, this.stderr); | ||
throw `non-zero RC: ${this._output.code}`; | ||
} | ||
return this; | ||
} | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
export class PROJECTFILE { | ||
private constructor(public projects: Array<Project>) | ||
{} | ||
|
||
public static async readFileAsync() : Promise<PROJECTFILE> { | ||
await PROJECTFILE.initAsync(); | ||
return new PROJECTFILE([]); | ||
} | ||
|
||
private static async initAsync() : Promise<void> { | ||
|
||
} | ||
|
||
private async writeFileAsync() : Promise<void> { | ||
|
||
} | ||
|
||
public projectExists(projectName: string) : boolean { | ||
return true; | ||
} | ||
|
||
public async addProjectAsync(projcetName: string) : Promise<void> { | ||
this.projects.push(new Project(projcetName)) | ||
await this.writeFileAsync(); | ||
} | ||
|
||
public getProjectId(projectName: string) : string { | ||
return ""; | ||
} | ||
} | ||
|
||
export class Project { | ||
constructor(public name: string) | ||
{} | ||
|
||
public get id(): string { | ||
return this.generateProjectId(this.name); | ||
} | ||
|
||
private generateProjectId(projectName: string) : string { | ||
return ""; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
export class PUNCHFILE { | ||
private constructor(public projectId: string, public punchId: string, public punchStart: Date, public shiftRate: number) | ||
{} | ||
|
||
public static async readFileAsync() : Promise<PUNCHFILE | null> { | ||
return null; | ||
} | ||
|
||
public static async createAsync(projectId: string, punchId: string, punchStart: Date, shiftRate: number) : Promise<void> { | ||
|
||
} | ||
|
||
public async deleteAsync(): Promise<void> { | ||
|
||
} | ||
} |