954
955
956
957
958
959
960
|
db_prepare(&q, "SELECT name, value FROM global_config ORDER BY name");
while( db_step(&q)==SQLITE_ROW ){
printf("%s=%s\n", db_column_text(&q, 0), db_column_text(&q, 1));
}
db_finalize(&q);
}
}
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
|
db_prepare(&q, "SELECT name, value FROM global_config ORDER BY name");
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?");
}
}
|