Skip to content

sncast completions can be broken by invalid config #4233

@DelevoXDG

Description

@DelevoXDG

Current State

Currently, with invalid global config, the command sncast completions will silently fail.

That means our starkup-added logic for loading completions:

# BEGIN FOUNDRY COMPLETIONS
_snforge() {
  if ! snforge completions zsh >/dev/null 2>&1; then
    return 0
  fi
  eval "$(snforge completions zsh)"
  _snforge "$@"
}

_sncast() {
  if ! sncast completions zsh >/dev/null 2>&1; then
    return 0
  fi
  eval "$(sncast completions zsh)"
  _sncast "$@"
}

compdef _snforge snforge
compdef _sncast sncast
# END FOUNDRY COMPLETIONS

will fail if we have invalid global config, e.g. one that has recently deprecated Starkscan as block explorer:

[sncast.default]
account = "user1"
network = "sepolia"
block-explorer = "StarkScan"

and the user won't have access to completions, which seems hard to debug for user to me.

Objective

sncast completions should skip the config loading parsing it doesn’t use anything from config anyway

Additional Context

There are maybe other commands that are loading config while they don't have to.

But, this is mainly important in completions context, since these are loaded based on starkup-added logic in .bashrc / .zshrc

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

Status

In Progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions