Skip to content

Commit

Permalink
Merge pull request #207 from jaredwray/adding-in-console-support
Browse files Browse the repository at this point in the history
Adding in console support
  • Loading branch information
jaredwray authored Oct 28, 2023
2 parents 3b00582 + ab0ee55 commit cba77cb
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
33 changes: 33 additions & 0 deletions src/console.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
export class WritrConsole {
log(message: string): void {
console.log(message);
}

error(message: string): void {
console.error(message);
}

warn(message: string): void {
console.warn(message);
}

printHelp(): void {
console.log(' Usage: writr [options] [command] [arguments]');
console.log();
console.log(' Options:');
console.log(' -h, --help output usage information');
console.log(' -v, --version output the version number');
console.log();
console.log(' Commands:');
console.log(' init Initialize a new project');
console.log(' build Build the project');
console.log(' serve Serve the project');
console.log();
console.log(' Arguments:');
console.log(' -p, --port Set the port number used with serve');
console.log(' -s, --silent Disable logging');
console.log(' -o, --output Set the output directory');
console.log(' -p, --path Set the path where files are located');
console.log(' -t, --template Set the path where files are located');
}
}
11 changes: 11 additions & 0 deletions src/writr.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import {WritrOptions} from './options.js';
import {WritrHelpers} from './helpers.js';
import {WritrConsole} from './console.js';

export class Writr {
private _options: WritrOptions = new WritrOptions();
private readonly _helpers: WritrHelpers = new WritrHelpers();
private readonly _console: WritrConsole = new WritrConsole();

constructor(options?: WritrOptions) {
if (options) {
Expand All @@ -22,4 +24,13 @@ export class Writr {
public get helpers(): WritrHelpers {
return this._helpers;
}

public execute(process: NodeJS.Process): void {
// Get the arguments
const args = process.argv.slice(2);

if (args.length === 0) {
this._console.printHelp();
}
}
}

0 comments on commit cba77cb

Please sign in to comment.