Implement i3 --moreversion

From the code:

    Connects to i3 to find out the currently running version. Useful since it
    might be different from the version compiled into this binary (maybe the
    user didn’t correctly install i3 or forgot te restart it).

Here is an example output:

    $ ./i3 --moreversion
    Binary i3 version:  4.2-202-gb8e782c (2012-08-12, branch "next") © 2009-2012 Michael Stapelberg and contributors
    Running i3 version: 4.2-202-gb8e782c (2012-08-12, branch "next") (pid 14804)

    The i3 binary you just called: /home/michael/i3/i3
    RUNNING BINARY DIFFERENT FROM BINARY ON DISK!
    The i3 binary you are running: /home/michael/i3/i3

    $ i3 restart
    2012-08-12 15:05:28 - Additional arguments passed. Sending them as a command to i3.
    IPC: received EOF instead of reply

    $ ./i3 --moreversion
    Binary i3 version:  4.2-202-gb8e782c (2012-08-12, branch "next") © 2009-2012 Michael Stapelberg and contributors
    Running i3 version: 4.2-202-gb8e782c (2012-08-12, branch "next") (pid 14804)

    The i3 binary you just called: /home/michael/i3/i3
    The i3 binary you are running: /home/michael/i3/i3
This commit is contained in:
Michael Stapelberg
2012-08-12 15:10:13 +02:00
parent b8e782c983
commit 1e49f1b08a
4 changed files with 203 additions and 1 deletions

View File

@ -257,6 +257,9 @@ int main(int argc, char *argv[]) {
{"no-autostart", no_argument, 0, 'a'},
{"config", required_argument, 0, 'c'},
{"version", no_argument, 0, 'v'},
{"moreversion", no_argument, 0, 'm'},
{"more-version", no_argument, 0, 'm'},
{"more_version", no_argument, 0, 'm'},
{"help", no_argument, 0, 'h'},
{"layout", required_argument, 0, 'L'},
{"restart", required_argument, 0, 0},
@ -294,7 +297,7 @@ int main(int argc, char *argv[]) {
start_argv = argv;
while ((opt = getopt_long(argc, argv, "c:CvaL:hld:V", long_options, &option_index)) != -1) {
while ((opt = getopt_long(argc, argv, "c:CvmaL:hld:V", long_options, &option_index)) != -1) {
switch (opt) {
case 'a':
LOG("Autostart disabled using -a\n");
@ -316,6 +319,12 @@ int main(int argc, char *argv[]) {
case 'v':
printf("i3 version " I3_VERSION " © 2009-2012 Michael Stapelberg and contributors\n");
exit(EXIT_SUCCESS);
break;
case 'm':
printf("Binary i3 version: " I3_VERSION " © 2009-2012 Michael Stapelberg and contributors\n");
display_running_version();
exit(EXIT_SUCCESS);
break;
case 'V':
set_verbosity(true);
break;