mirror of
https://github.com/MidnightCommander/mc
synced 2025-03-13 03:13:08 +03:00
Ticket #2495 (addition info about paths)
Added -F option (AKA --datadir-info) for show extended information about used data dirs display info about default used paths by 'mc -V' Signed-off-by: Ilia Maslakov <il.smind@gmail.com> Signed-off-by: Slava Zanko <slavazanko@gmail.com>
This commit is contained in:
parent
2a25a0943b
commit
ed70459b4d
15
src/args.c
15
src/args.c
@ -92,6 +92,7 @@ static GOptionContext *context;
|
||||
|
||||
static gboolean mc_args__nouse_subshell = FALSE;
|
||||
static gboolean mc_args__show_datadirs = FALSE;
|
||||
static gboolean mc_args__show_datadirs_extended = FALSE;
|
||||
|
||||
static GOptionGroup *main_group;
|
||||
|
||||
@ -113,6 +114,14 @@ static const GOptionEntry argument_main_table[] = {
|
||||
NULL
|
||||
},
|
||||
|
||||
/* show extended information about used data directories */
|
||||
{
|
||||
"datadir-info", 'F', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE,
|
||||
&mc_args__show_datadirs_extended,
|
||||
N_("Print extended info about used data directories"),
|
||||
NULL
|
||||
},
|
||||
|
||||
{
|
||||
"printwd", 'P', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_STRING,
|
||||
&mc_args__last_wd_file,
|
||||
@ -570,6 +579,12 @@ mc_args_process (int argc, char *argv[])
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (mc_args__show_datadirs_extended)
|
||||
{
|
||||
show_datadirs_extended ();
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (mc_args__force_colors)
|
||||
mc_global.args.disable_colors = FALSE;
|
||||
|
||||
|
@ -29,6 +29,9 @@
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "lib/global.h"
|
||||
#include "lib/fileloc.h"
|
||||
#include "lib/mcconfig.h"
|
||||
|
||||
#include "src/textconf.h"
|
||||
|
||||
/*** global variables ****************************************************************************/
|
||||
@ -158,3 +161,49 @@ show_version (void)
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
#define PRINTF_GROUP(a) \
|
||||
(void) printf ("[%s]\n", a)
|
||||
#define PRINTF_SECTION(a,b) \
|
||||
(void) printf (" %-17s %s\n", a, b)
|
||||
#define PRINTF_SECTION2(a,b) \
|
||||
(void) printf (" %-17s %s/\n", a, b)
|
||||
#define PRINTF(a, b, c) \
|
||||
(void) printf ("\t%-15s %s/%s\n", a, b, c)
|
||||
#define PRINTF2(a, b, c) \
|
||||
(void) printf ("\t%-15s %s%s\n", a, b, c)
|
||||
|
||||
void
|
||||
show_datadirs_extended (void)
|
||||
{
|
||||
PRINTF_GROUP (_("System data"));
|
||||
|
||||
PRINTF_SECTION ( _("Config directory:"), mc_global.sysconfig_dir);
|
||||
PRINTF_SECTION (_("Data directory:"), mc_global.share_data_dir);
|
||||
#ifdef ENABLE_VFS_EXTFS
|
||||
PRINTF2 ("extfs.d:", mc_global.share_data_dir, MC_EXTFS_DIR"/");
|
||||
#endif
|
||||
#ifdef ENABLE_VFS_FISH
|
||||
PRINTF2 ("fish:", mc_global.share_data_dir, FISH_PREFIX"/");
|
||||
#endif
|
||||
(void) puts ("");
|
||||
|
||||
PRINTF_GROUP (_("User data"));
|
||||
|
||||
PRINTF_SECTION2 ( _("Config directory:"), mc_config_get_path ());
|
||||
PRINTF_SECTION2 (_("Data directory:"), mc_config_get_data_path ());
|
||||
PRINTF ("skins:", mc_config_get_data_path (), MC_SKINS_SUBDIR"/");
|
||||
#ifdef ENABLE_VFS_EXTFS
|
||||
PRINTF ("extfs.d:", mc_config_get_data_path (), MC_EXTFS_DIR"/");
|
||||
#endif
|
||||
#ifdef ENABLE_VFS_FISH
|
||||
PRINTF ("fish:", mc_config_get_data_path (), FISH_PREFIX"/");
|
||||
#endif
|
||||
|
||||
PRINTF_SECTION2 ( _("Cache directory:"), mc_config_get_cache_path ());
|
||||
|
||||
}
|
||||
#undef PRINTF
|
||||
#undef PRINTF_SECTION
|
||||
#undef PRINTF_GROUP
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
@ -16,6 +16,7 @@
|
||||
/*** declarations of public functions ************************************************************/
|
||||
|
||||
extern void show_version (void);
|
||||
extern void show_datadirs_extended (void);
|
||||
|
||||
/*** inline functions ****************************************************************************/
|
||||
#endif /* MC__TEXTCONF_H */
|
||||
|
Loading…
x
Reference in New Issue
Block a user