Skip to content

Commit

Permalink
chore: convert unlink to use NetlifyLog
Browse files Browse the repository at this point in the history
  • Loading branch information
khendrikse committed Jan 11, 2024
1 parent 7450db3 commit 4b6a22c
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/commands/unlink/unlink.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import { OptionValues } from 'commander'

import { exit, log } from '../../utils/command-helpers.js'
import { NetlifyLog, intro, outro } from '../../utils/styles/index.js'
import { track } from '../../utils/telemetry/index.js'
import BaseCommand from '../base-command.js'

export const unlink = async (options: OptionValues, command: BaseCommand) => {
intro('unlink')
const { site, siteInfo, state } = command.netlify
const siteId = site.id

if (!siteId) {
log(`Folder is not linked to a Netlify site. Run 'netlify link' to link it`)
return exit()
NetlifyLog.error(`Folder is not linked to a Netlify site. Run 'netlify link' to link it`)
}

const siteData = siteInfo
Expand All @@ -22,8 +22,9 @@ export const unlink = async (options: OptionValues, command: BaseCommand) => {
})

if (site) {
log(`Unlinked ${site.configPath} from ${siteData ? siteData.name : siteId}`)
NetlifyLog.success(`Unlinked ${site.configPath} from ${siteData ? siteData.name : siteId}`)
} else {
log('Unlinked site')
NetlifyLog.success('Unlinked site')
}
outro()
}

0 comments on commit 4b6a22c

Please sign in to comment.