import { useT } from "../../i18n"; import { toast } from "../../dialogs"; import { Icon } from "../Icon"; import { useFetch } from "../../hooks"; import type { Info } from "../../types"; /** How to install and use the terminal client. */ export function CliInstall() { const t = useT(); const prebuilt = useFetch("/info").data?.cli_builds ?? false; const cmd = prebuilt ? `curl -fsSL ${location.origin}/cli/install.sh | sh` : "cargo install --locked --git https://git.familie-zink.org/zink/codecraft codecraft-cli"; const copy = (s: string) => navigator.clipboard.writeText(s).then(() => toast(t("tokens.copied"), "success")); return (

{t("cli.title")}

{t("cli.intro")}
  1. {t(prebuilt ? "cli.step1" : "cli.step1Source")}
    {cmd}
  2. {t("cli.step2")}
    {`codecraft login ${location.origin}`}
  3. {t("cli.step3")}
{prebuilt && (
{t("cli.downloads")} Linux x86_64 ยท Linux arm64
)}
); }