elegant-git

授权协议 MIT License
开发语言 SHELL
所属分类 应用工具、 终端/远程登录
软件类型 开源软件
地区 不详
投 递 者 松增
操作系统 跨平台
开源组织
适用人群 未知
 软件概览

Elegant Git

Elegant Git is an assistant who carefully automates routine work with Git.

Please visit https://elegant-git.bees-hive.org/ to get started with user documentation orclick on the picture �� �� �� to see a demo.



The contribution process at a glance

  1. Everyone contributing is governed by the Code of Conduct - please read it
  2. After, please get familiar with project rules described in CONTRIBUTING.md.
  3. Make a contribution

�� �� �� That's all! �� �� ��

Hands-on development notes

The information below guides you on different aspects of the development process. If you havesomething which should be quickly available, please propose changes here.

Table of contents

Architecture

The structure of directories:

.
├── .workflows/    <- stores development scripts
├── bin/           <- stores executable which is entry point
├── completions/   <- stores completion files
├── docs/          <- stores user documentation
├── libexec/       <- contains all commands
├── tests/         <- stores all tests along with additional test libraries
└── workflows      <- executes different development tasks

When you run git elegant ..., it initiates bin/git-elegant entry-point script. It callslibexec/git-elegant which is responsible for the execution of a given command by loading the codeof a desired command (using a command file like libexec/git-elegant-<command>) and executingit. Each command file has to provide the following BASH functions:

  • command-name prints a command name (line length is limited to 50 characters)
  • command-synopsis prints a usage statement (line length is limited to 80 characters)
  • command-description prints a command description (line length is limited to 80 characters)
  • default executes given command

Development environment

The following tools are needed for successful development:

  • Docker >= 19.03.2 is used for running tests
  • Elegant Git is used for running the testing process and generating documentation

Coding rules

We enforce having a consistent implementation by following the next strict rules:

  • add #!/usr/bin/env bash at the beginning of each script
  • use whether git-verbose or git-verbose-op instead of git command for well-formatted outputs
  • a private function (a usage in the scope of current script) should be prefixed with --

If you need to write a message to the system output, please use public functions inlibexec/plugins/text. All help messages have to use catfor printing them.

Debug mode

You can enable debug mode by running export GED=1 (the equivalent of set -x for bash).Run unset GED to switch debug off.

Testing procedure

A testing procedure consists of 3 steps:

  1. unit testing using bats-core
  2. installation testing
  3. validation of documentation correctness

All these steps can be executed by ./workflows ci which runs a Docker container (based onbeeshive/elegant-git-ci image) and calls all described checks. The image is also used on CI.If the image requires modifications, then

  1. run ./workflows prepare-worker <new tag> to build a new image
  2. update WORKER_IMAGE in ./workflows and test some workflow
  3. run ./workflows publich-worker <new tag> to push the image

Unit testing

Addons

In order to have a working unit tests, you need to add load addons-common line to each .batsfile. This addon configures right access to executables (libexec directory) and defines mandatoryfunctions.

Also, there are several optional addons which can be useful in some circumstances:

  • add load addons-repo to interact with real git repository
  • add load addons-fake to fake a Linux command
  • add load addons-cd to fake cd command
  • add load addons-read to fake read command

Writing tests

  1. Use setup() or teardown() bats methods only in the tests.
  2. Use check instead of bats run to execute a command to be tested.
  3. Use perform-verbose to execute any real command within a test which should not be tested.
  4. Use appropriate *-clean function within a teardown() method if the addon provides it.
  5. Do not fake git-elegant commands within the tests.

Assertions

  • [[ ${status} -eq 2 ]] for a command status
  • [[ ${#lines[@]} -eq 0 ]] for a length of command output
  • [[ ${lines[0]} = "+ the space " ]] for an output line (index starts from 0)
  • [[ ${lines[@]} =~ "exact string" ]] for an output line within whole output

Test name template

Use the following test name template - '<command>': <describes the behavior that will be tested>like 'clone-repository': stops with exit code 45 if cloneable URL is not set.

The behavior should be descriptive-style (stops with exit code 45 if cloneable URL is not set)rather than imperative-style (stop with exit code 45 if cloneable URL is not set).

Updating documentation

In order to get a preview of the documentation site locally, please run ./workflows serve-docsand open http://localhost (happens automatically if you have open command).

The docs/commands.md generates by running ./workflows generate-docs script.All other files in "docs" directory require manual corrections.

Completions testing

  1. source updated competion file
    • bash: source completions/git-elegant.bash
    • zsh: source completions/_git-elegant
  2. run git-elegant <some> and press Tab twice
  • NAME gittutorial - A tutorial introduction to Git SYNOPSIS git * DESCRIPTION This tutorial explains how to import a new project into Git, make changes to it, and share changes with other developers. I

 相关资料
  • Elegant Underline是一个简单的Android应用程序,用来演示如何创造更好的下划线文字效果。 这个简单的应用程序公开两个可能的实现: 基于路径的实现,需要API19 基于区域的实现,需要API1

  • Elegant Gnome Pack 是一个超级漂亮的 Ubuntu 主题,黑色风格,它提供了 PPA 源,所以安装起来非常方便。 # 安装:通过 PPA 源,支持 Ubuntu 10.04 / Linux Mint sudo add-apt-repository ppa:elegant-gnome/ppa sudo apt-get update sudo apt-get install eleg

  • Making Elegant Matlab Figures A repository comprising multiple functions for making elegant publication-quality figures in MATLAB.   Table of Contents Boxplot (figure_boxplot.m) GeneratePDF (generateP

  • 问题内容: 转到任何GitHub 页面,然后单击任何目录/文件,并观察URL的更改方式,但仅更新页面的一部分。没有整个页面重新加载。 我如何使用jQuery做类似的事情? 这对大多数浏览器都有效吗(我使用的是Chrome)? 问题答案: 他们使用历史记录API,或者专门使用。 您可以使用它,不需要jQuery,但是有一些插件,例如history.js。 这适用于大多数浏览器,即Chrome,Saf

  • 问题内容: 我尝试使用GIT,但是对我来说最大的问题是没有用于合并的工具。至少msysgit没有给我任何东西。如何在GIT中合并?是否有出色的工具,还是必须使用WinMerge或类似的应用程序? 我使用Java和Eclipse。 问题答案: 我建议kdiff3。安装它并放入类似的内容: 在你的 要编辑全局配置(.gitconfig): 您机器上的安装路径可能与有所不同。将上面的字符串替换为kdif

  • 问题内容: 我需要访问以获得有关某个存储库的一些数据。以下命令很好用 现在,我需要调用相同的名称来操纵输出。这是我尝试过的代码, 当我调试代码时,它向我显示此错误, HttpResponseProxy {HTTP / 1.1 400错误的请求[服务器:GitHub.com,日期:2017年2月3日,星期五,格林尼治标准时间12:14:58,内容类型:application / json; char