diff --git a/Dockerfile b/Dockerfile index f4a36d3..2ec088a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,6 +23,9 @@ USER $USERNAME # RUN sh -c "$(wget -O- https://github.com/deluan/zsh-in-docker/releases/download/v1.0.2/zsh-in-docker.sh)" -- \ COPY zsh-in-docker.sh /tmp RUN /tmp/zsh-in-docker.sh \ + -t https://github.com/denysdovhan/spaceship-prompt \ + -a 'SPACESHIP_PROMPT_ADD_NEWLINE="false"' \ + -a 'SPACESHIP_PROMPT_SEPARATE_LINE="false"' \ -p git \ -p https://github.com/zsh-users/zsh-autosuggestions \ -p https://github.com/zsh-users/zsh-completions \ diff --git a/test.sh b/test.sh index 6a98bfb..86e6b58 100755 --- a/test.sh +++ b/test.sh @@ -15,7 +15,7 @@ test_suite() { docker-compose up -d test-$image_name docker cp zsh-in-docker.sh zsh-in-docker_test-${image_name}_1:/tmp docker exec zsh-in-docker_test-${image_name}_1 sh /tmp/zsh-in-docker.sh \ - -t agnoster \ + -t https://github.com/denysdovhan/spaceship-prompt \ -p git -p git-auto-fetch \ -p https://github.com/zsh-users/zsh-autosuggestions \ -p https://github.com/zsh-users/zsh-completions \ @@ -31,7 +31,7 @@ test_suite() { echo "########################################################################################" echo "Test: zsh 5 was installed" && assert_contain "$VERSION" "zsh 5" "!" echo "Test: ~/.zshrc was generated" && assert_contain "$ZSHRC" 'ZSH="/root/.oh-my-zsh"' "!" - echo "Test: theme was configured" && assert_contain "$ZSHRC" 'ZSH_THEME="agnoster"' "!" + echo "Test: theme was configured" && assert_contain "$ZSHRC" 'ZSH_THEME="spaceship-prompt/spaceship"' "!" echo "Test: plugins were configured" && assert_contain "$ZSHRC" 'plugins=(git git-auto-fetch zsh-autosuggestions zsh-completions )' "!" echo "Test: line 1 is appended to ~/.zshrc" && assert_contain "$ZSHRC" 'CASE_SENSITIVE="true"' "!" echo "Test: line 2 is appended to ~/.zshrc" && assert_contain "$ZSHRC" 'HYPHEN_INSENSITIVE="true"' "!" diff --git a/zsh-in-docker.sh b/zsh-in-docker.sh index f1491bd..7ca65fd 100755 --- a/zsh-in-docker.sh +++ b/zsh-in-docker.sh @@ -100,9 +100,9 @@ export ZSH="$_HOME/.oh-my-zsh" ZSH_THEME="${_THEME}" plugins=($_PLUGINS) -source \$ZSH/oh-my-zsh.sh EOM printf "$ZSHRC_APPEND" + printf "\nsource \$ZSH/oh-my-zsh.sh" } powerline10k_config() { @@ -136,6 +136,16 @@ for plugin in $PLUGINS; do plugin_list="${plugin_list}$plugin_name " done +# Handle themes +if [ "`echo $THEME | grep -E '^http.*'`" != "" ]; then + theme_repo=`basename $THEME` + THEME_DIR="$HOME/.oh-my-zsh/custom/themes/$theme_repo" + git clone $THEME $THEME_DIR + theme_name=`cd $THEME_DIR; ls *.zsh-theme | head -1` + theme_name="${theme_name%.zsh-theme}" + THEME="$theme_repo/$theme_name" +fi + # Generate .zshrc zshrc_template "$HOME" "$THEME" "$plugin_list" > $HOME/.zshrc