Skip to content

Run completion script generation without previous setup #386

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions Sources/Swiftly/Proxy.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,18 @@ public enum Proxy {

if CommandLine.arguments.count == 1 {
// User ran swiftly with no extra arguments in an uninstalled environment, so we jump directly into
// an simple init.
// a simple init.
try await Init.execute(ctx, assumeYes: false, noModifyProfile: false, overwrite: false, platform: nil, verbose: false, skipInstall: false, quietShellFollowup: false)
return
} else if CommandLine.arguments.count >= 2 && CommandLine.arguments[1] == "init" {
// Let the user run the init command with their arguments, if any.
} else if CommandLine.arguments.count >= 2 && ["init", "--generate-completion-script"].contains(CommandLine.arguments[1]) {
// Let the user run the init command or completion script generation with arguments, if any.
await Swiftly.main()
return
} else if CommandLine.arguments.count == 2 && (CommandLine.arguments[1] == "--help" || CommandLine.arguments[1] == "--experimental-dump-help") {
// Allow the showing of help information
} else if CommandLine.arguments.count == 2 && ["--help", "--experimental-dump-help"].contains(CommandLine.arguments[1]) {
// Just print help information.
await Swiftly.main()
return
} else {
// We've been invoked outside the "init" subcommand and we're not yet configured.
// This will throw if the configuration couldn't be loaded and give the user an actionable message.
throw err
}
Expand Down