Skip to content

Commit

Permalink
Add more command-line view options
Browse files Browse the repository at this point in the history
Solves #148
  • Loading branch information
fabiocolacio committed May 29, 2018
1 parent ccbc432 commit c536065
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion src/marker.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,18 @@ marker_get_app()
return app;
}

static gboolean editor_mode_arg = FALSE;
static gboolean preview_mode_arg = FALSE;
static gboolean dual_pane_mode_arg = FALSE;
static gboolean dual_window_mode_arg = FALSE;
static gchar *outfile_arg = NULL;

static const GOptionEntry CLI_OPTIONS[] =
{
{ "preview", 'p', 0, G_OPTION_ARG_NONE, &preview_mode_arg, "Open in preview mode", NULL },
{ "editor", 'e', 0, G_OPTION_ARG_NONE, &editor_mode_arg, "Open in editor-only mode", NULL },
{ "preview", 'p', 0, G_OPTION_ARG_NONE, &preview_mode_arg, "Open in preview-only mode", NULL },
{ "dual-pane", 'd', 0, G_OPTION_ARG_NONE, &dual_pane_mode_arg, "Open in dual-pane mode", NULL },
{ "dual-window", 'w', 0, G_OPTION_ARG_NONE, &dual_window_mode_arg, "Open in dual-window mode", NULL },
{ "output", 'o', 0, G_OPTION_ARG_STRING, &outfile_arg, "Export the given markdown document as the given output file", NULL },
{ NULL }
};
Expand Down Expand Up @@ -229,6 +235,21 @@ marker_create_new_window_from_file (GFile *file)
MarkerEditor *editor = marker_window_get_active_editor (window);
marker_editor_set_view_mode (editor, PREVIEW_ONLY_MODE);
}
else if (editor_mode_arg)
{
MarkerEditor *editor = marker_window_get_active_editor (window);
marker_editor_set_view_mode (editor, EDITOR_ONLY_MODE);
}
else if (dual_pane_mode_arg)
{
MarkerEditor *editor = marker_window_get_active_editor (window);
marker_editor_set_view_mode (editor, DUAL_PANE_MODE);
}
else if (dual_window_mode_arg)
{
MarkerEditor *editor = marker_window_get_active_editor (window);
marker_editor_set_view_mode (editor, DUAL_WINDOW_MODE);
}
}


Expand Down

0 comments on commit c536065

Please sign in to comment.