Differences From:
File
src/db.c
part of check-in
[c82fb61775]
- Added support for a user defined diff command, which if set (fossil config diff-command), is run by default. The user can give a -i flag to run the internal diff command regardless of user defined diff command setting. Removed command tkdiff, no longer needed. Made the config remove message a bit more clear, when removing a config setting, it states it has been removed instead of telling you it's undefined.
by
jnc on
2007-09-24 06:53:46.
[view]
To:
File
src/db.c
part of check-in
[fff234b77c]
- Updates to the autosync logic. Add the "setting" command.
by
drh on
2007-09-25 20:23:52.
[view]
@@ -955,6 +955,44 @@
while( db_step(&q)==SQLITE_ROW ){
printf("%s=%s\n", db_column_text(&q, 0), db_column_text(&q, 1));
}
db_finalize(&q);
+ }
+}
+
+/*
+** COMMAND: setting
+** %fossil setting ?PROPERTY? ?VALUE?
+**
+** With no arguments, list all properties and their values. With just
+** a property name, show the value of that property. With a value
+** arugment, change the property for the current repository.
+*/
+void setting_cmd(void){
+ static const char *azName[] = {
+ "autosync",
+ "safemerge"
+ };
+ int i;
+ db_find_and_open_repository();
+ if( g.argc==2 ){
+ for(i=0; i<sizeof(azName)/sizeof(azName[0]); i++){
+ printf("%-20s %d\n", azName[i], db_get_int(azName[i], 0));
+ }
+ }else if( g.argc==3 || g.argc==4 ){
+ const char *zName = g.argv[2];
+ int n = strlen(zName);
+ for(i=0; i<sizeof(azName)/sizeof(azName[0]); i++){
+ if( strncmp(azName[i], zName, n)==0 ) break;
+ }
+ if( i>=sizeof(azName)/sizeof(azName[0]) ){
+ fossil_fatal("no such setting: %s", zName);
+ }
+ if( g.argc==4 ){
+ db_set(azName[i], g.argv[3]);
+ }else{
+ printf("%-20s %d\n", azName[i], db_get_int(azName[i], 0));
+ }
+ }else{
+ usage("?PROPERTY? ?VALUE?");
}
}