Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 16, 2026

The Nushell shell integration was generating invalid syntax by leaving unevaluated Go template directives ({{if .EnablePidCheck}}, {{end}}) in the output file, causing nu::parser::missing_positional errors.

Root cause: The nushell.Activate() method used string replacement instead of template parsing, unlike bash/zsh/fish which return template strings for evaluation in the activate command.

Changes:

  • Use text/template to parse and execute the nushell config template before writing to file
  • Template now correctly evaluates based on EnablePidCheck (set when TMUX env var is present)
  • Added tests verifying both tmux and non-tmux scenarios

Before (invalid Nushell):

def --env updateVfoxEnvironment [] {
  {{if .EnablePidCheck}}  # ← syntax error: missing cond
  # Check if PID changed...

After (valid Nushell):

def --env updateVfoxEnvironment [] {
  # Check if PID changed (e.g., in tmux new pane)
  if ($nu.pid != $env.__VFOX_PID) {
    $env.__VFOX_PID = $nu.pid
  }

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • version-fox.github.io
    • Triggering command: /tmp/go-build1279702276/b367/http.test /tmp/go-build1279702276/b367/http.test -test.testlogfile=/tmp/go-build1279702276/b367/testlog.txt -test.paniconexit0 -test.timeout=5m0s /tmp/go-build1279702276/b114/vet.cfg x64/src/runtime/cgo --global ache/go/1.24.11/x64/pkg/tool/linx86_64-linux-gnu pull.rebase (dns block)
    • Triggering command: /tmp/go-build581441233/b001/http.test /tmp/go-build581441233/b001/http.test -test.testlogfile=/tmp/go-build581441233/b001/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true 439551/b044/_pkggo1.24.11 x64/src/math/ran-c=4 ux_amd64/vet (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>[BUG]: Missing required positional argument</issue_title>
<issue_description>Version
vfox version 1.0.2

OS
Linux

Describe the bug
Since updating to the latest version, I have been getting the following error message in my shell (nushell 0.109.2):

Error: nu::parser::missing_positional

  × Missing required positional argument.
    ╭─[/home/pepper/.local/share/nushell/vendor/autoload/vfox.nu:10:25]
  9 │   def --env updateVfoxEnvironment [] {
 10 │     {{if .EnablePidCheck}}
    ·                         ▲
    ·                         ╰── missing cond
 11 │     # Check if PID changed (e.g., in tmux new pane)
    ╰────
  help: Usage: if <cond> <then_block> (else <else_expression>) . Use `--help` for more information.

</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits January 16, 2026 02:12
Co-authored-by: aooohan <40265686+aooohan@users.noreply.github.com>
Co-authored-by: aooohan <40265686+aooohan@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix missing required positional argument in updateVfoxEnvironment Fix Nushell template directive evaluation in activate command Jan 16, 2026
Copilot AI requested a review from aooohan January 16, 2026 02:16
@codecov
Copy link

codecov bot commented Jan 16, 2026

Codecov Report

❌ Patch coverage is 37.50000% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 22.07%. Comparing base (799c95a) to head (515864b).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
internal/shell/nushell.go 37.50% 2 Missing and 3 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #609      +/-   ##
==========================================
+ Coverage   21.94%   22.07%   +0.12%     
==========================================
  Files          80       80              
  Lines        5376     5381       +5     
==========================================
+ Hits         1180     1188       +8     
+ Misses       4065     4058       -7     
- Partials      131      135       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@liquidiert
Copy link

Hey @aooohan it's not just about the GO template. The line:

let currentValue = ($env.config | get -o hooks.pre_prompt)

also fails cause there is no arg -o. Correct arg is -i!

@aooohan
Copy link
Member

aooohan commented Jan 17, 2026

Hey @aooohan it's not just about the GO template. The line:

let currentValue = ($env.config | get -o hooks.pre_prompt)

also fails cause there is no arg -o. Correct arg is -i!

Ah, got it!

I'm not a Nushell user, so thanks for the correction!

@aooohan
Copy link
Member

aooohan commented Jan 17, 2026

fixed by 0930642

@aooohan aooohan closed this Jan 17, 2026
@liquidiert
Copy link

@aooohan thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG]: Missing required positional argument

3 participants