#include "control/libvlc_internal.h"
#include <vlc_input.h>
-#include "misc/modules.h"
-#include "misc/configuration.h"
+#include "modules/modules.h"
+#include "modules/configuration.h"
#include <errno.h> /* ENOMEM */
#include <stdio.h> /* sprintf() */
static int GetFilenames ( libvlc_int_t *, int, char *[] );
static void Help ( libvlc_int_t *, char const *psz_help_name );
static void Usage ( libvlc_int_t *, char const *psz_module_name );
-static void ListModules ( libvlc_int_t * );
+static void ListModules ( libvlc_int_t *, vlc_bool_t );
static void Version ( void );
#ifdef WIN32
module_InitBank( p_libvlc );
/* Hack: insert the help module here */
- p_help_module = vlc_object_create( p_libvlc, VLC_OBJECT_MODULE );
+ p_help_module = vlc_module_create( VLC_OBJECT(p_libvlc) );
if( p_help_module == NULL )
{
module_EndBank( p_libvlc );
/* Check for module list option */
else if( config_GetInt( p_libvlc, "list" ) )
{
- ListModules( p_libvlc );
+ ListModules( p_libvlc, VLC_FALSE );
+ b_exit = VLC_TRUE;
+ i_ret = VLC_EEXITSUCCESS;
+ }
+ else if( config_GetInt( p_libvlc, "list-verbose" ) )
+ {
+ ListModules( p_libvlc, VLC_TRUE );
b_exit = VLC_TRUE;
i_ret = VLC_EEXITSUCCESS;
}
}
}
/* we unreference the connection when we've finished with it */
- if( p_conn ) dbus_connection_unref( p_conn );
+ if( p_conn ) dbus_connection_unref( p_conn );
}
#endif
/* List all modules */
p_list = vlc_list_find( p_this, VLC_OBJECT_MODULE, FIND_ANYWHERE );
+ /* Ugly hack to make sure that the help options always come first
+ * (part 1) */
+ if( !psz_module_name )
+ Usage( p_this, "help" );
+
/* Enumerate the config for each module */
for( i_index = 0; i_index < p_list->i_count; i_index++ )
{
continue;
}
+ b_help_module = !strcmp( "help", p_parser->psz_object_name );
+ /* Ugly hack to make sure that the help options always come first
+ * (part 2) */
+ if( !psz_module_name && b_help_module )
+ continue;
+
/* Ignore modules with only advanced config options if requested */
if( !b_advanced )
{
else
utf8_fprintf( stdout, "\n %s\n", p_parser->psz_longname );
}
-
- b_help_module = !strcmp( "help", p_parser->psz_object_name );
+ if( p_parser->psz_help )
+ {
+ if( b_color )
+ utf8_fprintf( stdout, CYAN" %s\n"GRAY, p_parser->psz_help );
+ else
+ utf8_fprintf( stdout, " %s\n", p_parser->psz_help );
+ }
/* Print module options */
for( p_item = p_parser->p_config;
* Print a list of all available modules (builtins and plugins) and a short
* description for each one.
*****************************************************************************/
-static void ListModules( libvlc_int_t *p_this )
+static void ListModules( libvlc_int_t *p_this, vlc_bool_t b_verbose )
{
vlc_list_t *p_list = NULL;
module_t *p_parser = NULL;
char psz_spaces[22];
int i_index;
+ vlc_bool_t b_color = config_GetInt( p_this, "color" );
+
memset( psz_spaces, ' ', 22 );
#ifdef WIN32
if( i < 0 ) i = 0;
psz_spaces[i] = 0;
- utf8_fprintf( stdout, " %s%s %s\n", p_parser->psz_object_name,
- psz_spaces, p_parser->psz_longname );
+ if( b_color )
+ utf8_fprintf( stdout, GREEN" %s%s "WHITE"%s\n"GRAY,
+ p_parser->psz_object_name,
+ psz_spaces,
+ p_parser->psz_longname );
+ else
+ utf8_fprintf( stdout, " %s%s %s\n",
+ p_parser->psz_object_name,
+ psz_spaces, p_parser->psz_longname );
+
+ if( b_verbose )
+ {
+ const char **pp_shortcut = p_parser->pp_shortcuts;
+ while( pp_shortcut && *pp_shortcut )
+ {
+ if( strcmp( *pp_shortcut, p_parser->psz_object_name ) )
+ {
+ if( b_color )
+ utf8_fprintf( stdout, CYAN" s %s\n"GRAY,
+ *pp_shortcut );
+ else
+ utf8_fprintf( stdout, " s %s\n",
+ *pp_shortcut );
+ }
+ pp_shortcut++;
+ }
+ if( p_parser->psz_capability )
+ {
+ if( b_color )
+ utf8_fprintf( stdout, MAGENTA" c %s (%d)\n"GRAY,
+ p_parser->psz_capability,
+ p_parser->i_score );
+ else
+ utf8_fprintf( stdout, " c %s (%d)\n",
+ p_parser->psz_capability,
+ p_parser->i_score );
+ }
+ if( p_parser->psz_program )
+ {
+ if( b_color )
+ utf8_fprintf( stdout, YELLOW " p %s\n"GRAY,
+ p_parser->psz_program );
+ else
+ utf8_fprintf( stdout, " p %s\n", p_parser->psz_program );
+ }
+ }
psz_spaces[i] = ' ';
}
char **devices = NULL;
char *block_dev = NULL;
dbus_bool_t b_dvd;
+
#ifdef HAVE_HAL_1
DBusConnection *p_connection = NULL;
DBusError error;
-#endif
-#ifdef HAVE_HAL_1
ctx = libhal_ctx_new();
if( !ctx ) return;
dbus_error_init( &error );
p_connection = dbus_bus_get ( DBUS_BUS_SYSTEM, &error );
if( dbus_error_is_set( &error ) || !p_connection )
{
- libhal_ctx_shutdown( ctx, NULL );
dbus_error_free( &error );
return;
}
-#else
- ctx = hal_initialize( NULL, FALSE );
- if( !ctx ) return;
-#endif
-
-#ifdef HAVE_HAL_1
libhal_ctx_set_dbus_connection( ctx, p_connection );
if( libhal_ctx_init( ctx, &error ) )
#else
- if( ( ctx = hal_initialize( NULL, FALSE ) ) )
+ ctx = hal_initialize( NULL, FALSE );
+ if( ctx )
#endif
+
{
#ifdef HAVE_HAL_1
if( ( devices = libhal_get_all_devices( ctx, &i_devices, NULL ) ) )