remove zig build --init. add zig init-lib and zig init-exe

init-lib creates a working static library with tests, and
init-exe creates a working hello world with a `run` target.

both now have test coverage with the new "cli tests" file.

closes #1035
This commit is contained in:
Andrew Kelley
2018-09-17 17:08:56 -04:00
parent 9c9eefc841
commit 4c6f1e614a
15 changed files with 384 additions and 138 deletions

View File

@@ -1091,14 +1091,14 @@ Error os_fetch_file_path(Buf *full_path, Buf *out_contents, bool skip_shebang) {
return result;
}
int os_get_cwd(Buf *out_cwd) {
Error os_get_cwd(Buf *out_cwd) {
#if defined(ZIG_OS_WINDOWS)
char buf[4096];
if (GetCurrentDirectory(4096, buf) == 0) {
zig_panic("GetCurrentDirectory failed");
}
buf_init_from_str(out_cwd, buf);
return 0;
return ErrorNone;
#elif defined(ZIG_OS_POSIX)
char buf[PATH_MAX];
char *res = getcwd(buf, PATH_MAX);
@@ -1106,7 +1106,7 @@ int os_get_cwd(Buf *out_cwd) {
zig_panic("unable to get cwd: %s", strerror(errno));
}
buf_init_from_str(out_cwd, res);
return 0;
return ErrorNone;
#else
#error "missing os_get_cwd implementation"
#endif