Giter Site home page Giter Site logo

trietsch / spotify-cli Goto Github PK

View Code? Open in Web Editor NEW
21.0 2.0 5.0 117 KB

Spotify CLI built using Kotlin, CliKt and GraalVM (with native-image)

Home Page: https://www.youtube.com/watch?v=MWrAt1L6xpM

License: MIT License

Kotlin 97.58% Makefile 2.42%
cli kotlin graalvm-native-image clikt spotify spotify-web-api graalvm spotify-cli

spotify-cli's Introduction

Spotify CLI

This CLI can be used to control your Spotify account. It is meant as an example project to show how to build a command line interface in a language that runs on the JVM.

Watch the talk on YouTube to learn more about this CLI!

Installation

Download a binary from the releases page, and put the binary in your $PATH.

Autocomplete

This CLI supports autocomplete for various shells (bash, zsh, fish). To enable autocomplete, source the completion script upon starting a shell (through your profile, or rc file):

source <(spot --generate-completion bash)

Replace bash with the shell of your choice.

Compiling

In order to compile the source to a valid binary (that can be run standalone), make sure that you have the following installed:

  • GraalVM 20.3.0.r11 (or greater; should also work)
  • Native Image GraalVM component (gu install native-image)

Make sure when running maven, you've set GraalVM as the JDK to use in that shell (hence, JAVA_HOME is set to GraalVM). Tip: use direnv, and create an .envrc file in the root of this repository, with the following contents:

export JAVA_HOME=path/to/graalvm/java_home
export PATH=$JAVA_HOME/bin:$PATH

This automatically activates and sets GraalVM as the active JDK.

Client credentials

To successfully use the CLI, make sure to create application.conf in src/main/resources, with the following contents:

cli {
  clientId = "<the client id for your Spotify app>"
  clientSecret = "<the client secret for your Spotify app>"
}

To create a clientId and clientSecret, go to the Spotify Developer dashboard.

License

Feel free to use, copy, and modify this code to fit your needs. A reference towards this repository is appreciated :)

Disclaimer

The requested scopes for this app are far too much, don't do this in real life ;)

Credits

Multi platform builds inspired by this blog post.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.