Handle RAVC2_USER environment variable

This commit is contained in:
pancake 2021-07-26 17:00:36 +02:00
parent 67d43c4865
commit b552322004
2 changed files with 17 additions and 8 deletions

View File

@ -10,6 +10,8 @@ static void ravc2_show_help(void) {
" branch list all available branches\n"
" commit [a] [m] [f] perform a commit with the added files\n"
" branch [name] change to another branch\n"
"Environment:\n"
" RAVC2_USER=[name] Override cfg.user value to author commit.\n"
"Examples:\n"
" ravc2 init\n"
" man ravc2\n");
@ -103,7 +105,11 @@ R_API int r_main_ravc2(int argc, const char **argv) {
return -10;
}
}
char *author = r_sys_whoami ();
char *author = r_sys_getenv ("RAVC2_USER");
if (R_STR_ISEMPTY (author)) {
free (author);
author = r_sys_whoami ();
}
if (!author) {
free (message);
r_list_free (files);

View File

@ -1,11 +1,11 @@
.Dd Dec 28, 2020
.Dd Jul 26, 2021
.Dt RAVC2 1
.Sh NAME
.Nm ravc2
.Nd radare version control
.Sh SYNOPSIS
.Nm ravc2
.Op Fl ebBsSvxkKh
.Op Fl hv
.Op [expr] ...
.Sh DESCRIPTION
This command is part of the radare project.
@ -14,6 +14,7 @@ Implements a simple version control system that aims to work as frontend for git
.Pp
This command is pretty new and experimental.
.Sh OPTIONS
.Bl -tag -width Fl
.It Fl h
Show usage help message
.It Fl v
@ -22,12 +23,14 @@ Display version
.Sh USAGE
Available variable types are:
.Pp
ravc2 init
echo hello world > README.md
ravc2 add README.md
ravc2 branch
ravc2 commit
ravc2 init
echo hello world > README.md
ravc2 add README.md
ravc2 branch
ravc2 commit
.Pp
.Sh ENVIRONMENT
RAVC2_USER overrides cfg.user, which is based on r_sys_whoami() which is used to define the author for the VC commits.
.Sh SEE ALSO
.Pp
.Xr radare2(1)