diff --git a/doc/ncmpcpp.1 b/doc/ncmpcpp.1 index f65e539d..916f337a 100644 --- a/doc/ncmpcpp.1 +++ b/doc/ncmpcpp.1 @@ -15,6 +15,9 @@ Connect to server at host [localhost] .B \-p, \-\-port Connect to server at port [6600] .TP +.B \-s, \-\-screen +Specify the startup screen ( may be: help, playlist, browser, search-engine, media-library, playlist-editor, tag-editor, outputs, visualizer, clock) +.TP .B \-?, \-\-help Display help. .TP @@ -24,9 +27,6 @@ Display version information. .B \-\-now\-playing Display now playing song [{{(%l) }{{%a - }%t}}|{%f}}] .TP -.B \-\-screen -Specify the startup screen. -.TP .B play Start playing and exit. .TP diff --git a/src/helpers.cpp b/src/helpers.cpp index 6e7977d3..9d66749d 100644 --- a/src/helpers.cpp +++ b/src/helpers.cpp @@ -23,6 +23,7 @@ #include #include +#include "clock.h" #include "charset.h" #include "global.h" #include "helpers.h" @@ -34,6 +35,8 @@ #include "browser.h" #include "media_library.h" #include "search_engine.h" +#include "outputs.h" +#include "visualizer.h" bool ConnectToMPD() { @@ -122,10 +125,10 @@ void ParseArgv(int argc, char **argv) << "Usage: ncmpcpp [OPTION]...\n" << " -h, --host connect to server at host [localhost]\n" << " -p, --port connect to server at port [6600]\n" + << " -s, --screen specify the startup screen\n" << " -?, --help show this help message\n" << " -v, --version display version information\n" << " --now-playing display now playing song [" << now_playing_format << "]\n" - << " --screen specify the startup screen\n" << "\n" << " play start playing\n" << " pause pause the currently playing song\n" @@ -141,47 +144,46 @@ void ParseArgv(int argc, char **argv) if (!ConnectToMPD()) exit(0); - if (!strcmp(argv[i], "-s") || !strcmp(argv[i], "--screen")) - { - i++; - if (i == argc) { - std::cout << "ncmpcpp: no screen specified" << std::endl; - exit(0); - } - if (!strcmp(argv[i], "help")) - Config.startup_screen = myHelp; - else if (!strcmp(argv[i], "playlist")) - Config.startup_screen = myPlaylist; - else if (!strcmp(argv[i], "browser")) - Config.startup_screen = myBrowser; - else if (!strcmp(argv[i], "search")) - Config.startup_screen = mySearcher; - else if (!strcmp(argv[i], "media-library") || !strcmp(argv[i], "library")) - Config.startup_screen = myLibrary; - else if (!strcmp(argv[i], "playlist-editor")) - Config.startup_screen = myPlaylistEditor; -# ifdef HAVE_TAGLIB_H - else if (!strcmp(argv[i], "tag-editor")) - Config.startup_screen = myTagEditor; -# endif // HAVE_TAGLIB_H -# ifdef ENABLE_OUTPUTS - else if (!strcmp(argv[i], "outputs")) - Config.startup_screen = myOutputs; -# endif // ENABLE_OUTPUTS -# ifdef ENABLE_VISUALIZER - else if (!strcmp(argv[i], "visualizer")) - Config.startup_screen = myVisualizer; -# endif // ENABLE_VISUALIZER -# ifdef ENABLE_CLOCK - else if (!strcmp(argv[i], "clock")) - Config.startup_screen = myClock; -# endif // ENABLE_CLOCK - else { - std::cout << "ncmpcpp: invalid screen: " << argv[i] << std::endl; - exit(0); - } - } - else if (!strcmp(argv[i], "--now-playing")) + if (!strcmp(argv[i], "-s") || !strcmp(argv[i], "--screen")) + { + if (++i == argc) { + std::cout << "ncmpcpp: no screen specified" << std::endl; + exit(0); + } + if (!strcmp(argv[i], "help")) + Config.startup_screen = myHelp; + else if (!strcmp(argv[i], "playlist")) + Config.startup_screen = myPlaylist; + else if (!strcmp(argv[i], "browser")) + Config.startup_screen = myBrowser; + else if (!strcmp(argv[i], "search-engine")) + Config.startup_screen = mySearcher; + else if (!strcmp(argv[i], "media-library")) + Config.startup_screen = myLibrary; + else if (!strcmp(argv[i], "playlist-editor")) + Config.startup_screen = myPlaylistEditor; +# ifdef HAVE_TAGLIB_H + else if (!strcmp(argv[i], "tag-editor")) + Config.startup_screen = myTagEditor; +# endif // HAVE_TAGLIB_H +# ifdef ENABLE_OUTPUTS + else if (!strcmp(argv[i], "outputs")) + Config.startup_screen = myOutputs; +# endif // ENABLE_OUTPUTS +# ifdef ENABLE_VISUALIZER + else if (!strcmp(argv[i], "visualizer")) + Config.startup_screen = myVisualizer; +# endif // ENABLE_VISUALIZER +# ifdef ENABLE_CLOCK + else if (!strcmp(argv[i], "clock")) + Config.startup_screen = myClock; +# endif // ENABLE_CLOCK + else { + std::cout << "ncmpcpp: invalid screen: " << argv[i] << std::endl; + exit(0); + } + } + else if (!strcmp(argv[i], "--now-playing")) { Mpd.UpdateStatus(); if (!Mpd.GetErrorMessage().empty())