允许您快速选择jira问题并将其预处理为git commit消息
JiraIssueSelector的Python项目详细描述
JIRA问题选择器
一个小实用程序,用于自动选择和准备jira cloud发出的git commit消息的密钥。
安装:
只需运行:pip3 install JiraIssueSelector
(或者下载并使用the GitHub repo中的一个版本)
nb:此程序需要python 3.0或更高版本,使用curses支持进行编译。
配置:
问题选择器需要全局配置一次;然后再次配置一次 每个项目的时间。
要全局配置它,请键入:
git jira config global
要在本地配置它,请键入(在git存储库中):
git jira config local
如果默认情况下找不到这些文件,程序将自动 生成它们并提示您编辑它们。这只在第一次跑步时发生。每次运行程序时都应用global配置,而local配置特定于您当前所在的git repo和分支。
程序将所有配置和缓存文件存储在$HOME/.config/jira_issue_selector
。每次用户使用-u
标志调用脚本、更新配置文件或自上次运行程序以来已过配置文件的Refresh Interval
字段中指定的时间时,都会更新缓存文件。
在项目中创建新分支时,您可能不希望每次都填写本地配置;在这种情况下,请使用git jira config copy
命令输入交互式选择ui,以从另一个分支(甚至项目)复制/使用旧的配置。
nb:配置文件按以下顺序加载:Global -> Local -> Additional config specified by the user
用法:
git包装
usage: git jira [config global|local|copy] [help] [commit]
optional arguments:
[commit] Run the issue-selector, then pass the selected issue to 'git commit'
[config] same as the -e flag below. Note: Pass 'copy' to initiate the interactive config copying dialogue
[help] same as the -h flag below
原始python函数
usage: __main__.py [-h] [-n num_results_to_show] [-c path_to_config_file]
[-cc] [-u] [-e [global|local]] [-d] [-nc]
[-m COMMIT_MESSAGE] [-i issue_file_to_write_to]
A JIRA issue selector for git messages
optional arguments:
-h, --help show this help message and exit
-n num_results_to_show, --num-results num_results_to_show
The number of results to show on screen (default:
None)
-c path_to_config_file, --extra-config-path path_to_config_file
An extra config file to load. (default: None)
-cc, --copy-config Allows you to interactively select a pre-existing
config for the current local config. E.g. use this if
you want to copy the same config from another branch.
This overwrites the current config (default: False)
-u, --update-cache Update the issue cache. This happens automatically
according to the config (usually), but can be manually
controlled from here. (default: False)
-e [global|local], --edit-conf [global|local]
Edit a configuration file. Valid options are global or
local. The $EDITOR shell variable must be set for this
(default: )
-d, --dry-run Does not save anything to the disk (cache or
otherwise) (default: False)
-nc, --no-cache Disables reading and writing to the cache (default:
False)
-m COMMIT_MESSAGE, --commit-message COMMIT_MESSAGE
A message to automatically append to the key. (think
`git commit -m`) (default: None)
-i issue_file_to_write_to, --issue-file issue_file_to_write_to
The issue selected by the user will be written to this
file, if passed. Use this to actually receive the
output of the program. I recommend using mktemp to
generate this file path. (default: )
故障排除
我收到一个ImportError: No module named '_curses'
错误
注意:如果您使用自己编译的python版本,则很可能发生这种情况。
您的python版本没有使用curses支持进行编译。这很奇怪,因为大多数发行版都会附带它。一个解决方案是在ubuntu上安装curses库及其开发头(libncurses5-dev
,也许还有libncursesw5-dev
),然后编译一个新版本的python。
…或者您可以尝试找到用诅咒编译的python的打包版本。由你决定。我会在不支持它的机器上推荐前者。