Skip to content

Commit

Permalink
adjust readme
Browse files Browse the repository at this point in the history
  • Loading branch information
emilwidlund committed Nov 1, 2024
1 parent 2127361 commit 738e124
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 5 deletions.
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# checkout-link

Generate a checkout link for any kind of file from your command line.
Generate a checkout link for any kind of file from the command line.

### Getting Started

```bash
npx checkout-link ./path/to/file.zip
```
7 changes: 3 additions & 4 deletions src/cli.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { createProduct } from "./product.js";
import { productPrompt } from "./prompts/product.js";
import { authenticationMessage } from "./ui/authentication.js";
import { successMessage } from "./ui/success.js";
import { serverPrompt } from "./prompts/server.js";

process.on("uncaughtException", (error) => {
console.error(error);
Expand All @@ -22,9 +23,6 @@ const cli = meow(
`
Usage
$ checkout-link
Options
--sandbox, -s Use the sandbox environment.
`,
{
importMeta: import.meta,
Expand All @@ -42,9 +40,10 @@ const [filePath] = cli.input;

(async () => {
const product = await productPrompt();
const server = await serverPrompt();

await authenticationMessage();
const code = await login(cli.flags.sandbox ? "sandbox" : "production");
const code = await login(server);

const api = new Polar({
accessToken: code,
Expand Down
15 changes: 15 additions & 0 deletions src/prompts/server.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import prompts from "prompts";

export const serverPrompt = async () => {
const { server } = await prompts({
type: "select",
name: "server",
message: "Server",
choices: [
{ title: "Production", value: "production" },
{ title: "Sandbox", value: "sandbox" },
],
});

return server;
};

0 comments on commit 738e124

Please sign in to comment.