Skip to content

dev/sg: load flags from env var

Administrator requested to merge 03-24-dev_sg_load_flags_from_env_var into main

Created by: michaellzc

Motivation

I was running sg run docsite , then I am stuck in an infinite auto-update loop :(.

It probably had something to do with fish shell... I am not sure, maybe I'll take another look next week

Anyway, adding -skip-auto-update flag to all commands is annoying, why not just allow passing flags from env var?

⋊> ~/C/s/sourcegraph on 03-24-dev_sg_load_flags_from_env_var ⨯ sg run docsite                                                                          18:43:51
ℹ️ Auto updating sg ...
⌛ Stashing workspace...
⌛ Setting workspace up for update...
⌛ Updating to sg@666b1298ea3883bf3c6db209fe2f044cfedd5cde...
Compiling...
          _____                    _____  
         /\    \                  /\    \  
        /::\    \                /::\    \  
       /::::\    \              /::::\    \  
      /::::::\    \            /::::::\    \  
     /:::/\:::\    \          /:::/\:::\    \  
    /:::/__\:::\    \        /:::/  \:::\    \  
    \:::\   \:::\    \      /:::/    \:::\    \  
  ___\:::\   \:::\    \    /:::/    / \:::\    \  
 /\   \:::\   \:::\    \  /:::/    /   \:::\ ___\  
/::\   \:::\   \:::\____\/:::/____/  ___\:::|    |  
\:::\   \:::\   \::/    /\:::\    \ /\  /:::|____|  
 \:::\   \:::\   \/____/  \:::\    /::\ \::/    /  
  \:::\   \:::\    \       \:::\   \:::\ \/____/  
   \:::\   \:::\____\       \:::\   \:::\____\  
    \:::\  /:::/    /        \:::\  /:::/    /  
     \:::\/:::/    /          \:::\/:::/    /  
      \::::::/    /            \::::::/    /  
       \::::/    /              \::::/    /  
        \::/    /                \::/____/  
         \/____/  
  
                                                  
  sg installed to /Users/michael/.asdf/installs/golang/1.17.5/packages/bin/sg

  NOTE: this is NOT on your $PATH.  running sg will run '/Users/michael/.sg/sg' instead.


  Consider adding /Users/michael/.asdf/installs/golang/1.17.5/packages/bin to your $PATH for easier
  sg-ing!

  For example: append the following to your ~/.bashrc file:

      export PATH="/Users/michael/.asdf/installs/golang/1.17.5/packages/bin:$PATH"

  and reload your shell/terminal.

  If you use ZSH use ~/.zshrc, etc.
                                                  
                  Happy hacking!

  Run 'sg version changelog' to see what has changed.
✅ Update succeeded!
⌛ Restoring workspace...
ℹ️ Workspace restored!
ℹ️ Auto updating sg ...

Test plan

SG_SKIP_AUTO_UPDATE=true sg <something>

this doesn't trigger auto update for me

Merge request reports

Loading