-
-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: rename render to toHTML and print to toANSI
- Loading branch information
1 parent
6bb1398
commit ddc00b5
Showing
23 changed files
with
301 additions
and
127 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
@@ -1,10 +1,41 @@ | ||
import { run as axios } from './axios.js' | ||
/* | ||
* youch | ||
* | ||
* (c) Poppinss | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
import { createError } from '@poppinss/exception' | ||
|
||
import { run as pg } from './pg.js' | ||
import { Youch } from '../src/youch.js' | ||
import { run as axios } from './axios.js' | ||
import { run as drive } from './flydrive.js' | ||
|
||
const argv = process.argv.splice(2) | ||
const fn = argv[0] ?? 'axios' | ||
|
||
const E_COMMAND_NOT_FOUND = createError('Command not found', 'E_COMMAND_NOT_FOUND', 404) | ||
|
||
try { | ||
await axios() | ||
switch (fn) { | ||
case 'axios': | ||
await axios() | ||
break | ||
case 'drive': | ||
await drive() | ||
break | ||
case 'pg': | ||
await pg() | ||
break | ||
default: | ||
throw new E_COMMAND_NOT_FOUND() | ||
} | ||
} catch (error) { | ||
const youch = new Youch() | ||
const output = await youch.print(error) | ||
console.log(output) | ||
const output = await youch.toANSI(error) | ||
console.error(output) | ||
process.exit(1) | ||
} |
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
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
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 |
---|---|---|
@@ -1,9 +1,19 @@ | ||
/* | ||
* youch | ||
* | ||
* (c) Poppinss | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
import pg from 'pg' | ||
const client = new pg.Client({ | ||
user: 'postgres', | ||
}) | ||
await client.connect() | ||
|
||
export async function run() { | ||
const client = new pg.Client({ user: 'postgres' }) | ||
await client.connect() | ||
|
||
await client.query('SELECT * FROM users;') | ||
|
||
await client.end() | ||
} |
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
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
Oops, something went wrong.