Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Spack
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
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
eic_tools
Spack
Commits
da98b076
Commit
da98b076
authored
9 years ago
by
Todd Gamblin
Browse files
Options
Downloads
Patches
Plain Diff
Add more options to `spack edit`
parent
e58ee88a
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/spack/spack/cmd/edit.py
+21
-14
21 additions, 14 deletions
lib/spack/spack/cmd/edit.py
with
21 additions
and
14 deletions
lib/spack/spack/cmd/edit.py
+
21
−
14
View file @
da98b076
...
@@ -78,9 +78,18 @@ def setup_parser(subparser):
...
@@ -78,9 +78,18 @@ def setup_parser(subparser):
subparser
.
add_argument
(
subparser
.
add_argument
(
'
-f
'
,
'
--force
'
,
dest
=
'
force
'
,
action
=
'
store_true
'
,
'
-f
'
,
'
--force
'
,
dest
=
'
force
'
,
action
=
'
store_true
'
,
help
=
"
Open a new file in $EDITOR even if package doesn
'
t exist.
"
)
help
=
"
Open a new file in $EDITOR even if package doesn
'
t exist.
"
)
subparser
.
add_argument
(
'
-c
'
,
'
--command
'
,
dest
=
'
edit_command
'
,
action
=
'
store_true
'
,
filetypes
=
subparser
.
add_mutually_exclusive_group
()
help
=
"
Edit the command with the supplied name instead of a package.
"
)
filetypes
.
add_argument
(
'
-c
'
,
'
--command
'
,
dest
=
'
path
'
,
action
=
'
store_const
'
,
const
=
spack
.
cmd
.
command_path
,
help
=
"
Edit the command with the supplied name.
"
)
filetypes
.
add_argument
(
'
-t
'
,
'
--test
'
,
dest
=
'
path
'
,
action
=
'
store_const
'
,
const
=
spack
.
test_path
,
help
=
"
Edit the test with the supplied name.
"
)
filetypes
.
add_argument
(
'
-m
'
,
'
--module
'
,
dest
=
'
path
'
,
action
=
'
store_const
'
,
const
=
spack
.
module_path
,
help
=
"
Edit the main spack module with the supplied name.
"
)
subparser
.
add_argument
(
subparser
.
add_argument
(
'
name
'
,
nargs
=
'
?
'
,
default
=
None
,
help
=
"
name of package to edit
"
)
'
name
'
,
nargs
=
'
?
'
,
default
=
None
,
help
=
"
name of package to edit
"
)
...
@@ -88,19 +97,17 @@ def setup_parser(subparser):
...
@@ -88,19 +97,17 @@ def setup_parser(subparser):
def
edit
(
parser
,
args
):
def
edit
(
parser
,
args
):
name
=
args
.
name
name
=
args
.
name
if
args
.
edit_command
:
path
=
spack
.
packages_path
if
not
name
:
if
args
.
path
:
path
=
spack
.
cmd
.
command_
path
path
=
args
.
path
els
e
:
if
nam
e
:
path
=
join_path
(
spack
.
cmd
.
command_
path
,
name
+
"
.py
"
)
path
=
join_path
(
path
,
name
+
"
.py
"
)
if
not
os
.
path
.
exists
(
path
):
if
not
args
.
force
and
not
os
.
path
.
exists
(
path
):
tty
.
die
(
"
No command named
'
%s
'
.
"
%
name
)
tty
.
die
(
"
No command named
'
%s
'
.
"
%
name
)
spack
.
editor
(
path
)
spack
.
editor
(
path
)
elif
name
:
edit_package
(
name
,
args
.
force
)
else
:
else
:
# By default open the directory where packages or commands live.
# By default open the directory where packages or commands live.
if
not
name
:
spack
.
editor
(
path
)
path
=
spack
.
packages_path
spack
.
editor
(
path
)
else
:
edit_package
(
name
,
args
.
force
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment