Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add CLI command to open Sanity Learn #7409

Open
wants to merge 1 commit into
base: next
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/@sanity/cli/src/commands/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import docsCommand from './docs/docsCommand'
import helpCommand from './help/helpCommand'
import initCommand from './init/initCommand'
import installCommand from './install/installCommand'
import learnCommand from './learn/learnCommand'
import loginCommand from './login/loginCommand'
import logoutCommand from './logout/logoutCommand'
import manageCommand from './manage/manageCommand'
Expand All @@ -31,6 +32,7 @@ export const baseCommands: (CliCommandDefinition | CliCommandGroupDefinition)[]
debugCommand,
helpCommand,
projectsGroup,
learnCommand,
listProjectsCommand,
codemodCommand,
telemetryGroup,
Expand Down
20 changes: 20 additions & 0 deletions packages/@sanity/cli/src/commands/learn/learnCommand.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import open from 'open'

import {type CliCommandDefinition} from '../../types'

const learnCommand: CliCommandDefinition = {
name: 'learn',
helpText: '',
signature: 'learn',
description: 'Opens Sanity Learn in your web browser',
async action(args, context) {
const {output} = context
const {print} = output
const url = 'https://www.sanity.io/learn'

print(`Opening ${url}`)
await open(url)
},
}

export default learnCommand
Loading