import hud from './hud'

export async function copy(content?: null | string) {
  if (!content) {
    hud.error('无可复制的内容')
    return
  }
  try {
    await navigator.clipboard.writeText(content)
    hud.success('复制成功')
  } catch {
    hud.error('复制失败')
  }
}
