Last active
September 27, 2020 19:01
-
-
Save k-oguma/702beb7f5a3ba0cbc0ddfdc0e37f3992 to your computer and use it in GitHub Desktop.
It makes zenn-cli easier.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# It makes zenn-cli easier. | |
# Supported OS: ["macOS"] | |
# Requirements: make, perl | |
# [zenn-cli guide](https://zenn.dev/zenn/articles/zenn-cli-guide) | |
.PHONY: all help | |
.DEFAULT_GOAL := help | |
help: ## This help | |
@echo "Usage: make \033[36m[subCommand]\033[0m\n" | |
@printf "%-35s%s\n" "make" ": Easy zenn-cli" | |
@perl -lne ' /(.*):\s+?.*##\s+?(.*)/ and printf "%-s \033[36m%-30s\033[0m%s\n", "make", $$1, ": $$2"' $(MAKEFILE_LIST) | |
list_articles: ## View the article list. | |
@$(foreach val, $(notdir $(wildcard ./articles/*.md$)), echo ./articles/$(val):; printf "%-4s%s$$(grep '^title:' ./articles/$(val)|head -1)\n";) | |
list_books: ## View the book list. | |
@$(foreach val, $(dir $(wildcard ./books/*/config.yaml$)), echo $(val):; printf "%-4s%s$$(grep 'title:' $(val)/config.yaml)\n";) | |
article: ## Create an article. [Opt] You can specify `SLUG='****' make article_new`. | |
$(if $(SLUG),\ | |
@npx zenn new:article --slug $(SLUG),\ | |
@npx zenn new:article\ | |
) | |
book: ## Create a book. [Opt] You can specify `SLUG='****' make book_new`. | |
$(if $(SLUG),\ | |
@npx zenn new:book --slug $(SLUG),\ | |
@npx zenn new:book\ | |
) | |
preview: ## Open the preview | |
@npx zenn preview & | |
@open http://localhost:8000 | |
preview_close: ## Close the preview | |
@kill $(shell ps aux | grep zen\[n\] | awk '{print $$2}') | |
emoji: ## Get emoji. You can specify `EMOJI=${keyword} make emoji` | |
$(if $(EMOJI),\ | |
@w3m https://emojipedia.org/search/?q=$(EMOJI),\ | |
@w3m https://emojipedia.org/\ | |
) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment