Fossil SCM
Add the (user whoami) subcommand, which figures out who you are via db_find_and_open_repository(). In response to [forum:a174e200b018abbd | forum thread a174e200b018abbd].
Commit
a06df610c99bdf5c016c765651cf6b7eaf13aa5e265777279724006b45b744fd
Parent
4bb41f924263e2e…
1 file changed
+5
-1
+5
-1
| --- src/user.c | ||
| +++ src/user.c | ||
| @@ -503,13 +503,17 @@ | ||
| 503 | 503 | g.argv[4], uid |
| 504 | 504 | ); |
| 505 | 505 | db_protect_pop(); |
| 506 | 506 | } |
| 507 | 507 | fossil_print("%s\n", db_text(0, "SELECT info FROM user WHERE uid=%d", uid)); |
| 508 | + }else if( n==6 && strncmp(g.argv[2], "whoami", 6)==0 ){ | |
| 509 | + db_find_and_open_repository(0,0); | |
| 510 | + user_select(); | |
| 511 | + fossil_print("%s\n", g.zLogin); | |
| 508 | 512 | }else{ |
| 509 | 513 | fossil_fatal("user subcommand should be one of: " |
| 510 | - "capabilities contact default list new password"); | |
| 514 | + "capabilities contact default list new password whoami"); | |
| 511 | 515 | } |
| 512 | 516 | } |
| 513 | 517 | |
| 514 | 518 | /* |
| 515 | 519 | ** Attempt to set the user to zLogin |
| 516 | 520 |
| --- src/user.c | |
| +++ src/user.c | |
| @@ -503,13 +503,17 @@ | |
| 503 | g.argv[4], uid |
| 504 | ); |
| 505 | db_protect_pop(); |
| 506 | } |
| 507 | fossil_print("%s\n", db_text(0, "SELECT info FROM user WHERE uid=%d", uid)); |
| 508 | }else{ |
| 509 | fossil_fatal("user subcommand should be one of: " |
| 510 | "capabilities contact default list new password"); |
| 511 | } |
| 512 | } |
| 513 | |
| 514 | /* |
| 515 | ** Attempt to set the user to zLogin |
| 516 |
| --- src/user.c | |
| +++ src/user.c | |
| @@ -503,13 +503,17 @@ | |
| 503 | g.argv[4], uid |
| 504 | ); |
| 505 | db_protect_pop(); |
| 506 | } |
| 507 | fossil_print("%s\n", db_text(0, "SELECT info FROM user WHERE uid=%d", uid)); |
| 508 | }else if( n==6 && strncmp(g.argv[2], "whoami", 6)==0 ){ |
| 509 | db_find_and_open_repository(0,0); |
| 510 | user_select(); |
| 511 | fossil_print("%s\n", g.zLogin); |
| 512 | }else{ |
| 513 | fossil_fatal("user subcommand should be one of: " |
| 514 | "capabilities contact default list new password whoami"); |
| 515 | } |
| 516 | } |
| 517 | |
| 518 | /* |
| 519 | ** Attempt to set the user to zLogin |
| 520 |