Skip to content

Commit c1464ce

Browse files
committed
add no-dep flags
1 parent 8609a57 commit c1464ce

File tree

2 files changed

+24
-9
lines changed

2 files changed

+24
-9
lines changed

docs/content/programs/zigfetch.org

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#+TITLE: zigfetch
22
#+DATE: 2025-01-01T18:01:47+0800
3-
#+LASTMOD: 2025-01-02T23:02:00+0800
3+
#+LASTMOD: 2025-01-03T09:03:14+0800
44
#+TYPE: docs
55
#+DESCRIPTION: Fetch zig package, baked by libcurl.
66

@@ -12,7 +12,9 @@ Since the HTTP support within Zig's standard library isn't currently stable, thi
1212

1313
This poses a significant challenge for Chinese developers owing to [[https://en.wikipedia.org/wiki/Great_Firewall][the Great Firewall]].
1414

15-
So =zigfetch= is born, it's baked by libcurl, so [[https://curl.se/libcurl/c/libcurl-env.html][http_proxy/https_proxy]] env vars work as expected.
15+
As a consequence, =zigfetch= was developed; this tool operates via libcurl to ensure that both the =http_proxy= and =https_proxy= environment variables function correctly.
16+
17+
- https://curl.se/libcurl/c/libcurl-env.html
1618

1719
#+begin_src bash :results verbatim :exports result :dir ../../..
1820
./zig-out/bin/zigfetch --help
@@ -25,4 +27,17 @@ So =zigfetch= is born, it's baked by libcurl, so [[https://curl.se/libcurl/c/lib
2527
: OPTIONS:
2628
: -h, --help Show help
2729
: -v, --verbose Show verbose log
30+
: -n, --no-dep Disable fetch dependencies
2831
: -d, --debug-hash Print hash for each file
32+
33+
34+
This is a demo for socks5 proxy setup:
35+
36+
#+begin_src bash
37+
export http_proxy="socks5://127.0.0.1:1080"
38+
export https_proxy=$http_proxy
39+
export all_proxy=$http_proxy
40+
export GIT_SSH_COMMAND='ssh -o ProxyCommand="nc -X 5 -x 127.0.0.1:1080 %h %p"'
41+
#+end_src
42+
43+
=GIT_SSH_COMMAND= is used for fetch =git+http(s)= dependencies.

src/bin/zigfetch.zig

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,20 @@ pub const std_options: std.Options = .{
2020
const Args = struct {
2121
help: bool = false,
2222
verbose: bool = false,
23-
recursive: bool = true,
23+
@"no-dep": bool = false,
2424
@"debug-hash": bool = false,
2525

2626
pub const __shorts__ = .{
2727
.verbose = .v,
28-
.recursive = .r,
29-
.@"debug-hash" = .d,
3028
.help = .h,
29+
.@"no-dep" = .n,
30+
.@"debug-hash" = .d,
3131
};
3232
pub const __messages__ = .{
33-
.@"debug-hash" = "Print hash for each file",
34-
.verbose = "Show verbose log",
35-
.recursive = "Recursive fetch package dependencies",
3633
.help = "Show help",
34+
.verbose = "Show verbose log",
35+
.@"debug-hash" = "Print hash for each file",
36+
.@"no-dep" = "Disable fetch dependencies",
3737
};
3838
};
3939

@@ -102,7 +102,7 @@ fn calcHash(allocator: Allocator, dir: fs.Dir, root_dirname: []const u8, deleteI
102102
filter,
103103
deleteIgnore,
104104
);
105-
if (!args.recursive) {
105+
if (args.@"no-dep") {
106106
return Manifest.hexDigest(actual_hash);
107107
}
108108

0 commit comments

Comments
 (0)