Ejemplo n.º 1
0
        public void Register(CommandLineApplication app)
        {
            app.Command("tracks", (tracks) =>
            {
                tracks.Description = "Gets information about spotify tracks.";

                GetCommand(tracks);
                AudioFeaturesCommand(tracks);
                AudioAnalysisCommand(tracks);

                SubcommandHelper.ShowHelpOnExecute(tracks, _console);
            });
        }
Ejemplo n.º 2
0
        public void Register(CommandLineApplication app)
        {
            app.Command("playlists", (playlists) =>
            {
                playlists.Description = "Gets information and manage spotify playlists.";

                CreateCommand(playlists);
                ChangeCommand(playlists);
                GetCommand(playlists);
                GetItemsCommand(playlists);
                AddItemsCommand(playlists);
                OfUserCommand(playlists);

                SubcommandHelper.ShowHelpOnExecute(playlists, _console);
            });
        }
Ejemplo n.º 3
0
        public async Task <int> RunApp(string[] args, ServiceProvider services)
        {
            var app = new CommandLineApplication
            {
                Name        = ApplicationConfig.AppName,
                Description = "A cross-platform CLI Tool for requesting the Spotify Web API, with a focus on automation.",
            };

            app.Conventions.UseDefaultConventions();
            app.ValueParsers.Add(new StringListConverter(','));
            app.ValueParsers.Add(new SpotifyUriListConverter(','));
            app.ValueParsers.Add(new SpotifyUriConverter());

            services
            .GetServices <ICommand>()
            .ToList()
            .ForEach(c => c.Register(app));

            SubcommandHelper.ShowHelpOnExecute(app, _console);

            app.ExtendedHelpText = $"\n\nThe config file is located at {ApplicationConfig.AppConfigFilePath}";
            app.VersionOption(
                "--version",
                () => $"sp0 version {Version.AppVersion}"
                );

            app.CompletionCommand("completion", new List <ICompletionProvider> {
                new ZSHCompletionProvider()
            });

            try
            {
                return(await app.ExecuteAsync(args));
            }
            catch (APIException ex)
            {
                if (ex.Response != null)
                {
                    _console.WriteObject(new { Status = ex.Response.StatusCode, Error = ex.Message });
                }
                return(1);
            }
        }
Ejemplo n.º 4
0
        public void Register(CommandLineApplication app)
        {
            app.Command("player", (player) =>
            {
                player.Description = "Interact with Spotify Players over the Spotify Connect API Endpoints";

                PauseCommand(player);
                PlayCommand(player);
                QueueCommand(player);
                DevicesCommand(player);
                NextCommand(player);
                PreviousCommand(player);
                TransferCommand(player);
                CurrentPlaybackCommand(player);
                SeekPlaybackCommand(player);
                VolumeCommand(player);

                SubcommandHelper.ShowHelpOnExecute(player, _console);
            });
        }