Skip to content

Commit

Permalink
feat: added interactive check before opening feedback site
Browse files Browse the repository at this point in the history
  • Loading branch information
field123 committed Sep 22, 2023
1 parent a945294 commit 9b9c7dd
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
16 changes: 12 additions & 4 deletions packages/composable-cli/src/commands/feedback/feedback-command.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import yargs from "yargs"
import { CommandContext, CommandHandlerFunction } from "../../types/command"
import {
CommandContext,
CommandHandlerFunction,
RootCommandArguments,
} from "../../types/command"
import { handleErrors } from "../../util/error-handler"
import { renderInk } from "../../lib/ink/render-ink"
import React from "react"
Expand All @@ -11,9 +15,10 @@ import {
import open from "open"
import { Feedback } from "../ui/feedback/feedback"
import { trackCommandHandler } from "../../util/track-command-handler"
import { isTTY } from "../../util/is-tty"
export function createFeedbackCommand(
ctx: CommandContext
): yargs.CommandModule<{}, FeedbackCommandArguments> {
): yargs.CommandModule<RootCommandArguments, FeedbackCommandArguments> {
return {
command: "feedback",
describe: "Feedback to the Composable CLI",
Expand All @@ -30,8 +35,11 @@ export function createFeedbackCommandHandler(
FeedbackCommandError,
FeedbackCommandArguments
> {
return async function feedbackCommandHandler(_args) {
await open("https://elasticpath.dev/docs")
return async function feedbackCommandHandler(args) {
if (args.interactive && isTTY()) {
await open("https://elasticpath.dev/docs")
}

await renderInk(React.createElement(Feedback))
return {
success: true,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { EmptyObj } from "../../types/empty-object"
import { RootCommandArguments } from "../../types/command"

export type FeedbackCommandData = {}

Expand All @@ -7,4 +7,4 @@ export type FeedbackCommandError = {
message: string
}

export type FeedbackCommandArguments = EmptyObj
export type FeedbackCommandArguments = RootCommandArguments

0 comments on commit 9b9c7dd

Please sign in to comment.