用 Codex vibe 了一个快速在命令行设置代理的工具 - V2EX
V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
爱意满满的作品展示区。
taozhiw
V2EX    分享创造

用 Codex vibe 了一个快速在命令行设置代理的工具

  •  
  •   taozhiw 1 月 15 日 1022 次点击

    很多时候在终端需要设置代理,每次都要手动打开软件复制,所以 vibe 了一个命令行工具,会自动嗅探常用的代理软件,运行命令后会自动将环境变量写入剪切板,粘贴下就能运行,也支持了关闭、测试谷歌连接状态等。

    主要自己用,说不定有人能用上。分享出来。

    只在 mac 做了真机测试

    安装

    curl -fsSL https://raw.githubusercontent.com/cj0x39e/p/main/install.sh | sh 

    使用方法

    Command Purpose
    p copy proxy env commands to clipboard
    p on print shell commands to enable proxy
    p off print shell commands to disable proxy
    p status show detected proxy
    p detect show detection details
    p test test current proxy env with curl
    p set 7890 save local HTTP proxy port
    p --shell sh force output shell (sh, fish, ps)
    p --version print version

    仓库地址:

    https://github.com/cj0x39e/p

    10 条回复    2026-01-15 19:48:23 +08:00
    liangdi
        1
    liangdi  
       1 月 15 日
    我之前是用 shell function 搞的,确实可以做个见的程序来做,方便一些,我也去 vibe 一个 rust 的版本
    lyxxxh2
        2
    lyxxxh2  
       1 月 15 日
    这好鸡肋。

    设置到全局路径,claude_run.bat
    ```
    set http_proxy=http://127.0.0.1:9999
    set https_proxy=http://127.0.0.1:9999
    claude --dangerously-skip-permissions
    ```
    ShineyWang
        3
    ShineyWang  
       1 月 15 日
    div class="reply_content">你用的 terminal 没有快捷命令吗?
    直接放工具栏了


    还有 Ctrl+R 没用过吗?
    Alias4ck
        4
    Alias4ck  
       1 月 15 日
    这种代理不应该是你代理软件做的吗. 为啥本末倒置了, 另外开 tun 模式不是完全解决这种问题吗
    CloudMx
        5
    CloudMx  
       1 月 15 日
    有我这个方便?/狗头
    ```
    alias FQ='export https_proxy=http://127.0.0.1:7898 http_proxy=http://127.0.0.1:7898 all_proxy=socks5://127.0.0.1:7898'
    alias BFQ='export https_proxy= http_proxy= all_proxy='
    alias DL='export https_proxy=http://127.0.0.1:8080 http_proxy=http://127.0.0.1:8080'
    ```
    Vveeb
        6
    Vveeb  
       1 月 15 日
    @CloudMx #5 哈哈哈哈翻墙、不翻墙、最后那个“DL”是啥意思?
    aoling
        7
    aoling  
       1 月 15 日
    @CloudMx
    没见过你这么用的;
    删除变量正确写法
    alias BFQ='unset https_proxy http_proxy all_proxy'
    CloudMx
        8
    CloudMx  
       1 月 15 日
    @aoling 哈哈哈,设置成空一样的.
    taozhiw
        9
    taozhiw  
    OP
       1 月 15 日
    看来大家都各有小妙招。主要是现在 vibe 成本低,这种小场景做成工具不费事
    lemos1235
        10
    lemos1235  
       1 月 15 日
    大炮打蚊子
    关于     帮助文档     自助推广系统     博客     API     FAQ     Solana     2482 人在线   最高记录 6679       Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 30ms UTC 11:16 PVG 19:16 LAX 03:16 JFK 06:16
    Do have faith in what you're doing.
    ubao msn snddm index pchome yahoo rakuten mypaper meadowduck bidyahoo youbao zxmzxm asda bnvcg cvbfg dfscv mmhjk xxddc yybgb zznbn ccubao uaitu acv GXCV ET GDG YH FG BCVB FJFH CBRE CBC GDG ET54 WRWR RWER WREW WRWER RWER SDG EW SF DSFSF fbbs ubao fhd dfg ewr dg df ewwr ewwr et ruyut utut dfg fgd gdfgt etg dfgt dfgd ert4 gd fgg wr 235 wer3 we vsdf sdf gdf ert xcv sdf rwer hfd dfg cvb rwf afb dfh jgh bmn lgh rty gfds cxv xcv xcs vdas fdf fgd cv sdf tert sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf shasha9178 shasha9178 shasha9178 shasha9178 shasha9178 liflif2 liflif2 liflif2 liflif2 liflif2 liblib3 liblib3 liblib3 liblib3 liblib3 zhazha444 zhazha444 zhazha444 zhazha444 zhazha444 dende5 dende denden denden2 denden21 fenfen9 fenf619 fen619 fenfe9 fe619 sdf sdf sdf sdf sdf zhazh90 zhazh0 zhaa50 zha90 zh590 zho zhoz zhozh zhozho zhozho2 lislis lls95 lili95 lils5 liss9 sdf0ty987 sdft876 sdft9876 sdf09876 sd0t9876 sdf0ty98 sdf0976 sdf0ty986 sdf0ty96 sdf0t76 sdf0876 df0ty98 sf0t876 sd0ty76 sdy76 sdf76 sdf0t76 sdf0ty9 sdf0ty98 sdf0ty987 sdf0ty98 sdf6676 sdf876 sd876 sd876 sdf6 sdf6 sdf9876 sdf0t sdf06 sdf0ty9776 sdf0ty9776 sdf0ty76 sdf8876 sdf0t sd6 sdf06 s688876 sd688 sdf86