-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
3 changed files
with
43 additions
and
2 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,29 @@ | ||
import { CAC } from 'cac' | ||
import { version } from '../package.json' | ||
import { config } from '../src/config' | ||
|
||
const cli = new CAC('my-cli') | ||
|
||
interface ReverseProxyOption { | ||
from: string | ||
verbose: boolean | ||
} | ||
|
||
cli | ||
.command('start', 'Start the Reverse Proxy Server') | ||
.option('--from <from>', 'The URL to proxy from') | ||
.option('--verbose', 'Enable verbose logging') | ||
.example('reverse-proxy start --from localhost:5173 --to my-project.localhost') | ||
.action(async (options?: ReverseProxyOption) => { | ||
if (!options?.from || !options.to) { | ||
return startProxies(config) | ||
} | ||
}) | ||
|
||
cli.command('version', 'Show the version of the CLI').action(() => { | ||
console.log(version) | ||
}) | ||
|
||
cli.version(version) | ||
cli.help() | ||
cli.parse() |
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,2 @@ | ||
#!/usr/bin/env bun | ||
import('./bin/cli') |
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