Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 6d96e53

Browse files
fix(clib-install): check if version was specified when installing.
the names was used when writing the dependencies which causes this $ clib install package@0.1.0 is written on json as "package@0.1.0": "0.1.0"
1 parent d987893 commit 6d96e53

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

‎src/clib-install.c‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,15 @@ static int install_package(const char *slug) {
306306
}
307307

308308
if (0 == pkg->repo || 0 != strcmp(slug, pkg->repo)) {
309-
pkg->repo = strdup(slug);
309+
char* version_char = NULL;
310+
// NOTE: check if version was specified
311+
if ((version_char = strchr(slug, '@')) != NULL) {
312+
size_t length = version_char - slug;
313+
pkg->repo = malloc(sizeof(char) * length);
314+
memcpy(pkg->repo, slug, length);
315+
} else {
316+
pkg->repo = strdup(slug);
317+
}
310318
}
311319

312320
if (!opts.nosave) {

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /