POSTS
使用命令快速生成readme、gitignore文件
一、使用readme-md-generator来生成漂亮的readme文件
1.安装
With npm:
npm i -g readme-md-generator
With yarn:
yarn global add readme-md-generator
2.用法
安装好后直接使用命令提示生成readme文件
只需输入如下命令,然后根据交互式提示输入信息,然后会生成README.md文件:
readme
=>
➜ readme
✔ Project infos gathered
? 💡 Project name Test
? ℹ️ Project version (use empty value to skip) v0.1
? 📄 Project description 测试readme
? 🏠 Project homepage (use empty value to skip)
? 📘 Project documentation url (use empty value to skip)
? 👤 Author name johnny ting
? 👤 Github username (use empty value to skip) johnny ting
? 🐦 Twitter username (use empty value to skip)
? 📝 License name (use empty value to skip)
? 🔧 Issues page url (use empty value to skip)
? 📦 Install command (use empty value to skip) npm install
? 🚀 Usage command or instruction (use empty value to skip) test
? ✅ Test command (use empty value to skip)
✔ README template loaded
✔ README created
╔═══════════════════════════════════════════╗
║ ║
║ README.md was successfully generated. ║
║ Thanks for using readme-md-generator! ║
║ ║
╚═══════════════════════════════════════════╝
二、使用gi命令来创建gitignore文件
1.安装
我的机子是macOS,zsh环境,安装如下 (如果自己的是其他环境参考官方文档):
echo "function gi() { curl -sLw "\n" https://www.gitignore.io/api/\$@ ;}" >> \
~/.zshrc && source ~/.zshrc
2.用法
gi linux,java
=>
# Created by https://www.gitignore.io/api/linux,java
# Edit at https://www.gitignore.io/?templates=linux,java
### Java ###
# Compiled class file
*.class
# Log file
*.log
# BlueJ files
*.ctxt
# Mobile Tools for Java (J2ME)
.mtj.tmp/
# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
### Linux ###
*~
# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*
# KDE directory preferences
.directory
# Linux trash folder which might appear on any partition or disk
.Trash-*
# .nfs files are created when an open file is removed but is still being accessed
.nfs*
# End of https://www.gitignore.io/api/linux,java
3.命令输出到.gitignore文件
gi java,python >> .gitignore