Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bob.extension
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
bob
bob.extension
Merge requests
!103
Resolve "bob config fixes"
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Resolve "bob config fixes"
65-bob-config-fixes
into
master
Overview
4
Commits
4
Pipelines
5
Changes
2
Merged
Guillaume HEUSCH
requested to merge
65-bob-config-fixes
into
master
5 years ago
Overview
4
Commits
4
Pipelines
5
Changes
2
Expand
Closes
#65 (closed)
Edited
5 years ago
by
Guillaume HEUSCH
0
0
Merge request reports
Compare
master
version 3
3c5483ce
5 years ago
version 2
2c954533
5 years ago
version 1
ccb24b9a
5 years ago
master (base)
and
latest version
latest version
2568ca86
4 commits,
5 years ago
version 3
3c5483ce
3 commits,
5 years ago
version 2
2c954533
2 commits,
5 years ago
version 1
ccb24b9a
1 commit,
5 years ago
2 files
+
59
−
1
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
2
Search (e.g. *.vue) (Ctrl+P)
bob/extension/scripts/config.py
+
39
−
1
Options
"""
The manager for bob
'
s main configuration.
"""
from
..
import
rc
from
..rc_config
import
_saverc
,
_rc_to_str
,
_get_rc_path
from
..rc_config
import
_saverc
,
_rc_to_str
,
_get_rc_path
from
.click_helper
import
verbosity_option
,
AliasedGroup
import
logging
import
click
@@ -89,3 +89,41 @@ def set(key, value):
except
Exception
:
logger
.
error
(
"
Could not configure the rc file
"
,
exc_info
=
True
)
raise
click
.
ClickException
(
"
Failed to change the configuration.
"
)
@config.command
()
@click.argument
(
'
substr
'
)
@click.option
(
'
-c
'
,
'
--contain
'
,
is_flag
=
True
,
default
=
False
,
type
=
click
.
BOOL
,
show_default
=
True
)
def
unset
(
substr
,
contain
=
False
):
"""
Clear all variables starting (containing) with substring.
Clear all the variables that starts with the provided substring.
Each key/value pair for which the key starts with substring will be
removed from bob
'
s global configuration file.
\b
Arguments
---------
substring : str
The starting substring of one or several key(s)
\b
Parameters
----------
contain : bool
If set, check also for keys containing substring
"""
found
=
False
for
key
in
list
(
rc
.
keys
()):
if
key
.
startswith
(
substr
):
found
=
True
del
rc
[
key
]
if
contain
:
if
substr
in
key
:
del
rc
[
key
]
found
=
True
_saverc
(
rc
)
if
not
found
:
if
not
contain
:
logger
.
error
(
"
The key starting with
'
{}
'
was not found in the rc file
"
.
format
(
substr
))
else
:
logger
.
error
(
"
The key containing
'
{}
'
was not found in the rc file
"
.
format
(
substr
))
Loading