Skip to content
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions src/builtin.c
Original file line number Diff line number Diff line change
Expand Up @@ -1149,6 +1149,28 @@ static jv f_env(jq_state *jq, jv input) {
return env;
}

static jv f_expand_path(jq_state *jq, jv input) {
if (jv_get_kind(input) != JV_KIND_STRING) {
jv_free(input);
return type_error(input, "expand_path/1: string required");
}
return expand_path(input);
}

static jv f_get_home(jq_state *jq, jv input) {
jv_free(input);
return get_home();
}

static jv f_get_abspath(jq_state *jq, jv input) {
if (jv_get_kind(input) != JV_KIND_STRING) {
jv_free(input);
return type_error(input, "get_abspath/1: string required");
}
return jq_realpath(input);
}


static jv f_halt(jq_state *jq, jv input) {
jv_free(input);
jq_halt(jq, jv_invalid(), jv_invalid());
Expand Down Expand Up @@ -1738,6 +1760,9 @@ BINOPS
{f_error, "error", 1},
{f_format, "format", 2},
{f_env, "env", 1},
{f_expand_path, "expand_path", 1},
{f_get_home, "get_home", 1},
{f_get_abspath, "get_abspath", 1},
{f_halt, "halt", 1},
{f_halt_error, "halt_error", 2},
{f_get_search_list, "get_search_list", 1},
Expand Down