Skip to content

Commit

Permalink
feat: add CLI command to open Sanity Learn (#7409)
Browse files Browse the repository at this point in the history
  • Loading branch information
SimeonGriggs authored Oct 14, 2024
1 parent b693396 commit 1504511
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
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

0 comments on commit 1504511

Please sign in to comment.