Skip to content

Commit

Permalink
--version command line flag to print the version number
Browse files Browse the repository at this point in the history
  • Loading branch information
ldegio committed Aug 20, 2014
1 parent 29bb6b8 commit 85b44be
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
6 changes: 6 additions & 0 deletions userspace/sysdig/man/sysdig.8
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,12 @@ and exit.
.PD
Verbose output.
.PP
\f[B]\-\-version\f[]
.PD 0
.P
.PD
Print version number.
.PP
\f[B]\-w\f[] \f[I]writefile\f[], \f[B]\-\-write\f[]=\f[I]writefile\f[]
.PD 0
.P
Expand Down
3 changes: 3 additions & 0 deletions userspace/sysdig/man/sysdig.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,9 @@ OPTIONS
**-v**, **--verbose**
Verbose output.

**--version**
Print version number.

**-w** _writefile_, **--write**=_writefile_
Write the captured events to _writefile_.

Expand Down
9 changes: 9 additions & 0 deletions userspace/sysdig/sysdig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ static void usage()
" epoch, r for relative time from the beginning of the\n"
" capture, and d for delta between event enter and exit.\n"
" -v, --verbose Verbose output.\n"
" --version Print version number.\n"
" -w <writefile>, --write=<writefile>\n"
" Write the captured events to <writefile>.\n"
#ifndef DISABLE_CGW
Expand Down Expand Up @@ -695,6 +696,7 @@ sysdig_init_res sysdig_init(int argc, char **argv)
{"summary", no_argument, 0, 'S' },
{"timetype", required_argument, 0, 't' },
{"verbose", no_argument, 0, 'v' },
{"version", no_argument, 0, 0 },
{"writefile", required_argument, 0, 'w' },
#ifndef DISABLE_CGW
{"limit", required_argument, 0, 'W' },
Expand Down Expand Up @@ -992,6 +994,13 @@ sysdig_init_res sysdig_init(int argc, char **argv)
default:
break;
}

if(string(long_options[long_index].name) == "version")
{
printf("sysdig version %s\n", SYSDIG_VERSION);
delete inspector;
return sysdig_init_res(EXIT_SUCCESS);
}
}

inspector->set_buffer_format(event_buffer_format);
Expand Down

0 comments on commit 85b44be

Please sign in to comment.