Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
408b9c7a
Commit
408b9c7a
authored
Sep 10, 2007
by
Rafaël Carré
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Attempt to fix zsh completion
parent
b73d36cd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
25 deletions
+54
-25
extras/Makefile
extras/Makefile
+1
-1
extras/zsh.cpp
extras/zsh.cpp
+53
-24
No files found.
extras/Makefile
View file @
408b9c7a
zsh
:
zsh.cpp
zsh
:
zsh.cpp
g++
-I
..
-I
../include zsh.cpp ../src/
libvlc.a
-o
zsh
`
top_builddir
=
.. ../vlc-config vlc
builtin
--cflags
--libs
`
g++
-I
..
-I
../include zsh.cpp ../src/
.libs/libvlc.so
-o
zsh
`
top_builddir
=
.. ../vlc-config vlc
builtin
--cflags
--libs
`
extras/zsh.cpp
View file @
408b9c7a
...
@@ -35,8 +35,8 @@ typedef std::pair<int, std::string> mcpair;
...
@@ -35,8 +35,8 @@ typedef std::pair<int, std::string> mcpair;
#include <vlc/vlc.h>
#include <vlc/vlc.h>
void
ParseModules
(
vlc_t
*
p_
vlc
,
mmap
&
mods
,
mcmap
&
mods2
);
void
ParseModules
(
libvlc_int_t
*
p_lib
vlc
,
mmap
&
mods
,
mcmap
&
mods2
);
void
PrintModuleList
(
vlc_t
*
p_
vlc
,
mmap
&
mods
,
mcmap
&
mods2
);
void
PrintModuleList
(
libvlc_int_t
*
p_lib
vlc
,
mmap
&
mods
,
mcmap
&
mods2
);
void
ParseOption
(
module_config_t
*
p_item
,
mmap
&
mods
,
mcmap
&
mods2
);
void
ParseOption
(
module_config_t
*
p_item
,
mmap
&
mods
,
mcmap
&
mods2
);
void
PrintOption
(
char
*
psz_option
,
char
i_short
,
char
*
psz_exlusive
,
void
PrintOption
(
char
*
psz_option
,
char
i_short
,
char
*
psz_exlusive
,
char
*
psz_text
,
char
*
psz_longtext
,
char
*
psz_args
);
char
*
psz_text
,
char
*
psz_longtext
,
char
*
psz_args
);
...
@@ -47,21 +47,21 @@ int main( int i_argc, char **ppsz_argv )
...
@@ -47,21 +47,21 @@ int main( int i_argc, char **ppsz_argv )
mcmap
mods2
;
mcmap
mods2
;
/* Create a libvlc structure */
/* Create a libvlc structure */
int
i_ret
=
VLC_Create
();
int
i_ret
=
VLC_Create
();
vlc_t
*
p_
vlc
;
libvlc_int_t
*
p_lib
vlc
;
if
(
i_ret
<
0
)
if
(
i_ret
<
0
)
{
{
return
i_ret
;
return
i_ret
;
}
}
/* Initialize libvlc */
/* Initialize libvlc */
i_ret
=
VLC_Init
(
0
,
i_argc
,
ppsz_argv
);
i_ret
=
VLC_Init
(
0
,
i_argc
,
ppsz_argv
);
if
(
i_ret
<
0
)
if
(
i_ret
<
0
)
{
{
VLC_Destroy
(
0
);
VLC_Destroy
(
0
);
return
i_ret
;
return
i_ret
;
}
}
p_
vlc
=
vlc_current_object
(
i_ret
);
p_
libvlc
=
(
libvlc_int_t
*
)
vlc_object_get
(
(
vlc_object_t
*
)
NULL
,
i_ret
);
printf
(
"#compdef vlc
\n\n
"
printf
(
"#compdef vlc
\n\n
"
"#This file is autogenerated by zsh.cpp
\n
"
"#This file is autogenerated by zsh.cpp
\n
"
...
@@ -69,10 +69,10 @@ int main( int i_argc, char **ppsz_argv )
...
@@ -69,10 +69,10 @@ int main( int i_argc, char **ppsz_argv )
"local context state line ret=1
\n
"
"local context state line ret=1
\n
"
"local modules
\n\n
"
);
"local modules
\n\n
"
);
PrintModuleList
(
p_vlc
,
mods
,
mods2
);
PrintModuleList
(
p_
lib
vlc
,
mods
,
mods2
);
printf
(
"_arguments -S -s
\\\n
"
);
printf
(
"_arguments -S -s
\\\n
"
);
ParseModules
(
p_vlc
,
mods
,
mods2
);
ParseModules
(
p_
lib
vlc
,
mods
,
mods2
);
printf
(
"
\"
(--module)-p[print help on module]:print help on module:($modules)
\"\\\n
"
);
printf
(
"
\"
(--module)-p[print help on module]:print help on module:($modules)
\"\\\n
"
);
printf
(
"
\"
(-p)--module[print help on module]:print help on module:($modules)
\"\\\n
"
);
printf
(
"
\"
(-p)--module[print help on module]:print help on module:($modules)
\"\\\n
"
);
printf
(
"
\"
(--help)-h[print help]
\"\\\n
"
);
printf
(
"
\"
(--help)-h[print help]
\"\\\n
"
);
...
@@ -107,15 +107,16 @@ int main( int i_argc, char **ppsz_argv )
...
@@ -107,15 +107,16 @@ int main( int i_argc, char **ppsz_argv )
}
}
void
ParseModules
(
vlc_t
*
p_
vlc
,
mmap
&
mods
,
mcmap
&
mods2
)
void
ParseModules
(
libvlc_int_t
*
p_lib
vlc
,
mmap
&
mods
,
mcmap
&
mods2
)
{
{
vlc_list_t
*
p_list
=
NULL
;;
vlc_list_t
*
p_list
=
NULL
;;
module_t
*
p_module
;
module_t
*
p_module
;
module_config_t
*
p_item
;
module_config_t
*
p_item
;
int
i_index
;
int
i_index
;
int
i_items
;
/* List the plugins */
/* List the plugins */
p_list
=
vlc_list_find
(
p_vlc
,
VLC_OBJECT_MODULE
,
FIND_ANYWHERE
);
p_list
=
vlc_list_find
(
p_
lib
vlc
,
VLC_OBJECT_MODULE
,
FIND_ANYWHERE
);
if
(
!
p_list
)
return
;
if
(
!
p_list
)
return
;
for
(
i_index
=
0
;
i_index
<
p_list
->
i_count
;
i_index
++
)
for
(
i_index
=
0
;
i_index
<
p_list
->
i_count
;
i_index
++
)
{
{
...
@@ -131,6 +132,7 @@ void ParseModules( vlc_t *p_vlc, mmap &mods, mcmap &mods2 )
...
@@ -131,6 +132,7 @@ void ParseModules( vlc_t *p_vlc, mmap &mods, mcmap &mods2 )
// printf( " #%s\n", p_module->psz_longname );
// printf( " #%s\n", p_module->psz_longname );
if
(
!
p_item
)
continue
;
if
(
!
p_item
)
continue
;
i_items
=
0
;
do
do
{
{
if
(
p_item
->
i_type
==
CONFIG_CATEGORY
)
if
(
p_item
->
i_type
==
CONFIG_CATEGORY
)
...
@@ -144,19 +146,20 @@ void ParseModules( vlc_t *p_vlc, mmap &mods, mcmap &mods2 )
...
@@ -144,19 +146,20 @@ void ParseModules( vlc_t *p_vlc, mmap &mods, mcmap &mods2 )
if
(
p_item
->
i_type
&
CONFIG_ITEM
)
if
(
p_item
->
i_type
&
CONFIG_ITEM
)
ParseOption
(
p_item
,
mods
,
mods2
);
ParseOption
(
p_item
,
mods
,
mods2
);
}
}
while
(
p_item
->
i_type
!=
CONFIG_HINT_END
&&
p_item
++
);
while
(
i_items
++
<
p_module
->
i_config_items
&&
p_item
++
);
}
}
}
}
void
PrintModuleList
(
vlc_t
*
p_
vlc
,
mmap
&
mods
,
mcmap
&
mods2
)
void
PrintModuleList
(
libvlc_int_t
*
p_lib
vlc
,
mmap
&
mods
,
mcmap
&
mods2
)
{
{
vlc_list_t
*
p_list
=
NULL
;;
vlc_list_t
*
p_list
=
NULL
;;
module_t
*
p_module
;
module_t
*
p_module
;
int
i_index
;
int
i_index
;
int
i_items
;
/* List the plugins */
/* List the plugins */
p_list
=
vlc_list_find
(
p_vlc
,
VLC_OBJECT_MODULE
,
FIND_ANYWHERE
);
p_list
=
vlc_list_find
(
p_
lib
vlc
,
VLC_OBJECT_MODULE
,
FIND_ANYWHERE
);
if
(
!
p_list
)
return
;
if
(
!
p_list
)
return
;
printf
(
"modules=
\"
"
);
printf
(
"modules=
\"
"
);
...
@@ -172,15 +175,16 @@ void PrintModuleList( vlc_t *p_vlc, mmap &mods, mcmap &mods2 )
...
@@ -172,15 +175,16 @@ void PrintModuleList( vlc_t *p_vlc, mmap &mods, mcmap &mods2 )
mods
.
insert
(
mpair
(
p_module
->
psz_capability
,
mods
.
insert
(
mpair
(
p_module
->
psz_capability
,
p_module
->
psz_object_name
)
);
p_module
->
psz_object_name
)
);
module_config_t
*
p_config
=
p_module
->
p_config
;
module_config_t
*
p_config
=
p_module
->
p_config
;
i_items
=
0
;
if
(
p_config
)
do
if
(
p_config
)
do
{
{
/* Hack: required subcategory is stored in i_min */
/* Hack: required subcategory is stored in i_min */
if
(
p_config
->
i_type
==
CONFIG_SUBCATEGORY
)
if
(
p_config
->
i_type
==
CONFIG_SUBCATEGORY
)
{
{
mods2
.
insert
(
mcpair
(
p_config
->
i_value
,
mods2
.
insert
(
mcpair
(
p_config
->
value
.
i
,
p_module
->
psz_object_name
)
);
p_module
->
psz_object_name
)
);
}
}
}
while
(
p_config
->
i_type
!=
CONFIG_HINT_END
&&
p_config
++
);
}
while
(
i_items
++
<
p_module
->
i_config_items
&&
p_config
++
);
if
(
p_module
->
b_submodule
)
if
(
p_module
->
b_submodule
)
continue
;
continue
;
printf
(
"%s "
,
p_module
->
psz_object_name
);
printf
(
"%s "
,
p_module
->
psz_object_name
);
...
@@ -196,6 +200,12 @@ void ParseOption( module_config_t *p_item, mmap &mods, mcmap &mods2 )
...
@@ -196,6 +200,12 @@ void ParseOption( module_config_t *p_item, mmap &mods, mcmap &mods2 )
char
*
psz_arguments
=
""
;
char
*
psz_arguments
=
""
;
char
*
psz_exclusive
;
char
*
psz_exclusive
;
char
*
psz_option
;
char
*
psz_option
;
char
*
psz_name
;
char
*
psz_text
;
char
*
psz_longtext
;
#define DUP( x ) strdup( x ? x : "" )
//Skip deprecated options
//Skip deprecated options
if
(
p_item
->
psz_current
)
if
(
p_item
->
psz_current
)
return
;
return
;
...
@@ -219,7 +229,7 @@ void ParseOption( module_config_t *p_item, mmap &mods, mcmap &mods2 )
...
@@ -219,7 +229,7 @@ void ParseOption( module_config_t *p_item, mmap &mods, mcmap &mods2 )
case
CONFIG_ITEM_MODULE_CAT
:
case
CONFIG_ITEM_MODULE_CAT
:
{
{
std
::
pair
<
mcmap
::
iterator
,
mcmap
::
iterator
>
range
=
std
::
pair
<
mcmap
::
iterator
,
mcmap
::
iterator
>
range
=
mods2
.
equal_range
(
p_item
->
i_min
);
mods2
.
equal_range
(
p_item
->
min
.
i
);
std
::
string
list
=
(
*
range
.
first
).
second
;
std
::
string
list
=
(
*
range
.
first
).
second
;
++
range
.
first
;
++
range
.
first
;
while
(
range
.
first
!=
range
.
second
)
while
(
range
.
first
!=
range
.
second
)
...
@@ -234,7 +244,7 @@ void ParseOption( module_config_t *p_item, mmap &mods, mcmap &mods2 )
...
@@ -234,7 +244,7 @@ void ParseOption( module_config_t *p_item, mmap &mods, mcmap &mods2 )
case
CONFIG_ITEM_MODULE_LIST_CAT
:
case
CONFIG_ITEM_MODULE_LIST_CAT
:
{
{
std
::
pair
<
mcmap
::
iterator
,
mcmap
::
iterator
>
range
=
std
::
pair
<
mcmap
::
iterator
,
mcmap
::
iterator
>
range
=
mods2
.
equal_range
(
p_item
->
i_min
);
mods2
.
equal_range
(
p_item
->
min
.
i
);
std
::
string
list
=
"_values -s , "
;
std
::
string
list
=
"_values -s , "
;
list
=
list
.
append
(
p_item
->
psz_name
);
list
=
list
.
append
(
p_item
->
psz_name
);
while
(
range
.
first
!=
range
.
second
)
while
(
range
.
first
!=
range
.
second
)
...
@@ -319,7 +329,7 @@ void ParseOption( module_config_t *p_item, mmap &mods, mcmap &mods2 )
...
@@ -319,7 +329,7 @@ void ParseOption( module_config_t *p_item, mmap &mods, mcmap &mods2 )
free
(
psz_list
);
free
(
psz_list
);
}
}
else
if
(
p_item
->
i_min
!=
0
||
p_item
->
i_max
!=
0
)
else
if
(
p_item
->
min
.
i
!=
0
||
p_item
->
max
.
i
!=
0
)
{
{
// p_control = new RangedIntConfigControl( p_this, p_item, parent );
// p_control = new RangedIntConfigControl( p_this, p_item, parent );
}
}
...
@@ -342,21 +352,35 @@ void ParseOption( module_config_t *p_item, mmap &mods, mcmap &mods2 )
...
@@ -342,21 +352,35 @@ void ParseOption( module_config_t *p_item, mmap &mods, mcmap &mods2 )
psz_arguments
=
NULL
;
psz_arguments
=
NULL
;
asprintf
(
&
psz_exclusive
,
"--no%s --no-%s"
,
p_item
->
psz_name
,
asprintf
(
&
psz_exclusive
,
"--no%s --no-%s"
,
p_item
->
psz_name
,
p_item
->
psz_name
);
p_item
->
psz_name
);
PrintOption
(
p_item
->
psz_name
,
p_item
->
i_short
,
psz_exclusive
,
psz_name
=
DUP
(
p_item
->
psz_name
);
p_item
->
psz_text
,
p_item
->
psz_longtext
,
psz_arguments
);
psz_text
=
DUP
(
p_item
->
psz_text
);
psz_longtext
=
DUP
(
p_item
->
psz_longtext
);
PrintOption
(
psz_name
,
p_item
->
i_short
,
psz_exclusive
,
psz_text
,
psz_longtext
,
psz_arguments
);
free
(
psz_name
);
free
(
psz_text
);
free
(
psz_longtext
);
free
(
psz_exclusive
);
free
(
psz_exclusive
);
asprintf
(
&
psz_exclusive
,
"--no%s --%s"
,
p_item
->
psz_name
,
asprintf
(
&
psz_exclusive
,
"--no%s --%s"
,
p_item
->
psz_name
,
p_item
->
psz_name
);
p_item
->
psz_name
);
asprintf
(
&
psz_option
,
"no-%s"
,
p_item
->
psz_name
);
asprintf
(
&
psz_option
,
"no-%s"
,
p_item
->
psz_name
);
psz_text
=
DUP
(
p_item
->
psz_text
);
psz_longtext
=
DUP
(
p_item
->
psz_longtext
);
PrintOption
(
psz_option
,
p_item
->
i_short
,
psz_exclusive
,
PrintOption
(
psz_option
,
p_item
->
i_short
,
psz_exclusive
,
p_item
->
psz_text
,
p_item
->
psz_longtext
,
psz_arguments
);
psz_text
,
psz_longtext
,
psz_arguments
);
free
(
psz_text
);
free
(
psz_longtext
);
free
(
psz_exclusive
);
free
(
psz_exclusive
);
free
(
psz_option
);
free
(
psz_option
);
asprintf
(
&
psz_exclusive
,
"--no-%s --%s"
,
p_item
->
psz_name
,
asprintf
(
&
psz_exclusive
,
"--no-%s --%s"
,
p_item
->
psz_name
,
p_item
->
psz_name
);
p_item
->
psz_name
);
asprintf
(
&
psz_option
,
"no%s"
,
p_item
->
psz_name
);
asprintf
(
&
psz_option
,
"no%s"
,
p_item
->
psz_name
);
psz_text
=
DUP
(
p_item
->
psz_text
);
psz_longtext
=
DUP
(
p_item
->
psz_longtext
);
PrintOption
(
psz_option
,
p_item
->
i_short
,
psz_exclusive
,
PrintOption
(
psz_option
,
p_item
->
i_short
,
psz_exclusive
,
p_item
->
psz_text
,
p_item
->
psz_longtext
,
psz_arguments
);
psz_text
,
psz_longtext
,
psz_arguments
);
free
(
psz_text
);
free
(
psz_longtext
);
free
(
psz_exclusive
);
free
(
psz_exclusive
);
free
(
psz_option
);
free
(
psz_option
);
return
;
return
;
...
@@ -368,9 +392,14 @@ void ParseOption( module_config_t *p_item, mmap &mods, mcmap &mods2 )
...
@@ -368,9 +392,14 @@ void ParseOption( module_config_t *p_item, mmap &mods, mcmap &mods2 )
default:
default:
break
;
break
;
}
}
PrintOption
(
p_item
->
psz_name
,
p_item
->
i_short
,
NULL
,
psz_name
=
DUP
(
p_item
->
psz_name
);
p_item
->
psz_text
,
p_item
->
psz_longtext
,
psz_arguments
);
psz_text
=
DUP
(
p_item
->
psz_text
);
psz_longtext
=
DUP
(
p_item
->
psz_longtext
);
PrintOption
(
psz_name
,
p_item
->
i_short
,
NULL
,
psz_text
,
psz_longtext
,
psz_arguments
);
free
(
psz_name
);
free
(
psz_text
);
free
(
psz_longtext
);
}
}
void
PrintOption
(
char
*
psz_option
,
char
i_short
,
char
*
psz_exclusive
,
void
PrintOption
(
char
*
psz_option
,
char
i_short
,
char
*
psz_exclusive
,
...
...
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