Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
binwalk
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fact-gitdep
binwalk
Commits
a122a09a
Commit
a122a09a
authored
Nov 28, 2013
by
devttys0
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed binwalk completion file.
parent
6a97595f
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
96 deletions
+0
-96
binwalk.completion
src/binwalk.completion
+0
-52
setup.py
src/setup.py
+0
-44
No files found.
src/binwalk.completion
deleted
100644 → 0
View file @
6a97595f
# Bash auto-completion file for binwalk
_binwalk()
{
local cur prev opts long_opts short_opts file_opts
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
# Long and short options are dynamically generated by setup.py
long_opts="%%LONG_OPTS%%"
short_opts="%%SHORT_OPTS%%"
file_opts="--file --extract --magic"
opts="${long_opts} ${short_opts}"
# If this is a long option, then tab complete a list of matching long options
if [[ ${cur} == --* ]]
then
COMPREPLY=( $(compgen -W "${long_opts}" -- ${cur}) )
# Else, if this is any other option, tab complete it from then entire list of valid options
elif [[ ${cur} == -* ]]
then
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
# Finally, if this is not an option at all, tab complete a list of files
else
COMPREPLY=( $(compgen -f ${cur}) )
fi
# If there is only one matching option, and if it is a long option, then don't put a space after the equals sign.
if [ "$(echo "$COMPREPLY" | wc -w)" == "1" ] && [ "$(echo "$COMPREPLY" | grep -e '=$')" != "" ]
then
compopt -o nospace;
# Else, if there are no matching options, check to see if the previous option is a long option that takes a file path argument
elif [ "$COMPREPLY" == "" ]
then
for file_opt in ${file_opts}
do
if [ "${prev}" == "${file_opt}" ]
then
# If the previous option does take a file path argument, tab complete a list of files
COMPREPLY=( $(compgen -f "") )
break
fi
done
fi
return 0
}
complete -F _binwalk binwalk
src/setup.py
View file @
a122a09a
...
...
@@ -133,47 +133,3 @@ setup( name = "binwalk",
scripts
=
[
"bin/binwalk"
],
)
# If the bash auto-completion directory exists, generate an auto-completion file
bash_completion_dir
=
os
.
path
.
join
(
'/'
,
'etc'
,
'bash_completion.d'
)
if
os
.
path
.
exists
(
bash_completion_dir
):
import
binwalk.cmdopts
print
(
"Installing bash auto-completion file"
)
long_opts_key
=
'
%%
LONG_OPTS
%%
'
short_opts_key
=
'
%%
SHORT_OPTS
%%
'
file_opts_key
=
'
%%
FILE_OPTS
%%
'
file_name_in
=
'binwalk.completion'
file_name_out
=
os
.
path
.
join
(
bash_completion_dir
,
'binwalk'
)
long_opts
=
[]
short_opts
=
[]
file_opts
=
[
'--file='
,
'--extract='
,
'--magic='
]
for
opt
in
binwalk
.
cmdopts
.
short_options
:
if
opt
!=
':'
:
short_opts
.
append
(
'-'
+
opt
)
for
opt
in
binwalk
.
cmdopts
.
long_options
:
long_opts
.
append
(
'--'
+
opt
)
try
:
with
open
(
file_name_in
)
as
fd_in
:
with
open
(
file_name_out
,
'w'
)
as
fd_out
:
for
line
in
fd_in
.
readlines
():
if
long_opts_key
in
line
:
line
=
line
.
replace
(
long_opts_key
,
' '
.
join
(
long_opts
))
elif
short_opts_key
in
line
:
line
=
line
.
replace
(
short_opts_key
,
' '
.
join
(
short_opts
))
elif
file_opts_key
in
line
:
line
=
line
.
replace
(
file_opts_key
,
' '
.
join
(
file_opts
))
fd_out
.
write
(
line
)
except
Exception
as
e
:
print
(
"WARNING: Failed to install auto-completion file:
%
s"
%
e
)
try
:
os
.
unlink
(
file_name_out
)
except
:
pass
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment