Files
fish-config/functions/_mkrep_default_remote_cmd.fish
T
rootiest 859f14a6e9 feat(functions): tag CLASSIFICATION across functions/ and conf.d/
Audits every function's interaction with the C1-shadowed commands
(uses-shadow/bypasses-shadow) and general hazards (destructive,
network, blocking-prompt) per the CLASSIFICATION schema.

Delegated the initial mechanical sweep to agy, then reviewed every
file by hand: fixed a systemic double-blank-comment-line formatting
bug from the delegate pass, and corrected several judgment errors
found on review -- three false blocking-prompt tags where a fish
'read' was consuming piped input rather than waiting on a terminal
(open-url.fish, sbver.fish, play-media.fish, now untagged entirely),
a blocking-prompt tag on mkrep.fish despite its documented --yes
escape hatch, an untagged read in jobrunner.fish's own baseless
blocking-prompt claim (removed, along with a destructive tag on
cleanup of its own mktemp output -- the schema explicitly excludes
that), the same own-output-cleanup false positive on
_zellij_dump_log.fish's destructive tag, an interactive fzf-gated
confirmation on logs.fish and replay.fish's piped read misread the
same way as the first three, and a uses-shadow(mkdir) on mkcd.fish
that actually belongs to the _fish_mkdir_p helper it delegates to,
not to mkcd itself.
2026-09-21 21:26:44 -04:00

41 lines
1.5 KiB
Fish

# Copyright (C) 2026 Rootiest
# SPDX-License-Identifier: AGPL-3.0-or-later
# CLASSIFICATION
# network
#
# SYNOPSIS
# _mkrep_default_remote_cmd <type>
#
# DESCRIPTION
# Prints the default remote-create command template for <type>, used by
# mkrep's --server flow when $MKREP_REMOTE_CMD is unset. Same {name},
# {user}, {server} placeholders as --new-remote. gitlab/gitea guard
# their final push on HEAD actually resolving to a commit -- mkrep only
# ever runs `git init`, so a fresh call has no commit yet, and
# `git push -u origin HEAD` errors on an unborn HEAD regardless of the
# remote. Skipping the push there is silent success, not a swallowed
# failure: once a commit exists, a real push failure still propagates.
#
# ARGUMENTS
# type gitea, gitlab, or github
#
# RETURNS
# The template string, on stdout
#
# EXIT STATUS
# 0 known type
# 1 unrecognized type
function _mkrep_default_remote_cmd --argument-names type
switch $type
case github
echo 'gh repo create {name} --private --source=. --remote=origin --push'
case gitlab
echo 'glab repo create {name} --private --skipGitInit && git remote add origin {server}/{user}/{name}.git && if git rev-parse --verify -q HEAD >/dev/null 2>&1; git push -u origin HEAD; end'
case gitea
echo 'tea repos create --name {name} --private && git remote add origin {server}/{user}/{name}.git && if git rev-parse --verify -q HEAD >/dev/null 2>&1; git push -u origin HEAD; end'
case '*'
return 1
end
end