Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Hanaasagi committed Jun 24, 2023
1 parent 7a34077 commit 9d7dc14
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,53 @@ ME="/koyori"
HOME="${HO}${ME}" # equal to HOME=/home/koyori
```

## Installation

Add `dotenv` as dependency in `build.zig.zon`:

```
.{
.name = "my-project",
.version = "0.1.0",
.dependencies = .{
.dotenv = .{
.url = "https://github.com/dying-will-bullet/dotenv/archive/refs/tags/v0.1.0.tar.gz",
.hash = "1220c77566ceedb0a89844ac490c1afe9c5e396818680e73e4a2e8dcadd9ac896724",
},
},
}
```

Add `dotenv` as a module in `build.zig`:

```
diff --git a/build.zig b/build.zig
index 957f625..66dd12a 100644
--- a/build.zig
+++ b/build.zig
@@ -15,6 +15,9 @@ pub fn build(b: *std.Build) void {
// set a preferred release mode, allowing the user to decide how to optimize.
const optimize = b.standardOptimizeOption(.{});
+ const opts = .{ .target = target, .optimize = optimize };
+ const dotenv_module = b.dependency("dotenv", opts).module("dotenv");
+
const exe = b.addExecutable(.{
.name = "tmp",
// In this case the main source file is merely a path, however, in more
@@ -23,6 +26,8 @@ pub fn build(b: *std.Build) void {
.target = target,
.optimize = optimize,
});
+ exe.addModule("dotenv", dotenv_module);
+ // If you want to modify environment variables.
+ exe.linkSystemLibrary("c");
// This declares intent for the executable to be installed into the
// standard location when the user invokes the "install" step (the default
```

## LICENSE

MIT License Copyright (c) 2023, Hanaasagi

0 comments on commit 9d7dc14

Please sign in to comment.