mirror of
https://github.com/SkinnyMind/libgit2dart.git
synced 2025-05-04 12:19:09 -04:00
feat(config): update example
This commit is contained in:
parent
36f874c4a6
commit
f07fe88824
1 changed files with 10 additions and 2 deletions
|
@ -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');
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue