feat(config): update example

This commit is contained in:
Aleksey Kulikov 2021-06-18 18:15:33 +03:00
parent 36f874c4a6
commit f07fe88824

View file

@ -17,12 +17,20 @@ void main() {
try {
final repoConfig = Config.open(path: '.git/config');
print('All entries of repo config:');
print('\nAll entries of repo config:');
final entries = repoConfig.getEntries();
for (final entry in entries.entries) {
print('${entry.key}: ${entry.value}');
}
// Set value of config variable
repoConfig.setValue('core.variable', 'value');
print(
'\nNew value for variable "core.variable": ${repoConfig.getValue('core.variable')}');
// Delete variable
repoConfig.deleteEntry('core.variable');
repoConfig.close();
} catch (e) {
print(e);
@ -33,7 +41,7 @@ void main() {
try {
final globalConfig = Config.global();
// get value of config variable
// Get value of config variable.
final userName = globalConfig.getValue('user.name');
print('\nUser Name from global config: $userName');