diff options
| author | typebrook <typebrook@gmail.com> | 2020-03-17 09:15:49 +0800 |
|---|---|---|
| committer | typebrook <typebrook@gmail.com> | 2020-03-17 09:16:10 +0800 |
| commit | 71ab694bb824f0b3305f72ce14e3f30826bb7250 (patch) | |
| tree | eb75533f8bb6129b0d7570004e8a37654e2cae44 | |
| parent | 11c169ba0bc0836c138eb3890d9fbd9710e145ac (diff) | |
Refactor code for order of functions
| -rwxr-xr-x | gist | 30 |
1 files changed, 15 insertions, 15 deletions
| @@ -302,21 +302,6 @@ _grep_content() { | |||
| 302 | done < $INDEX | 302 | done < $INDEX |
| 303 | } | 303 | } |
| 304 | 304 | ||
| 305 | # Open Github repository import page | ||
| 306 | _import_to_github() { | ||
| 307 | _gist_id "$1" || return 1 | ||
| 308 | echo put the folowing URL into web page: | ||
| 309 | echo -n "git@github.com:$GIST_ID.git" | ||
| 310 | python -mwebbrowser https://github.com/new/import | ||
| 311 | } | ||
| 312 | |||
| 313 | # Simply commit current changes and push to remote | ||
| 314 | _push_to_remote() { | ||
| 315 | _gist_id "$1" || return 1 | ||
| 316 | cd "$folder/$GIST_ID" && git add . \ | ||
| 317 | && git commit --allow-empty-message -m '' && git push origin master | ||
| 318 | } | ||
| 319 | |||
| 320 | # Parse JSON object of the result of gist fetch | 305 | # Parse JSON object of the result of gist fetch |
| 321 | _parse_gists() { | 306 | _parse_gists() { |
| 322 | _process_json ' | 307 | _process_json ' |
| @@ -513,6 +498,21 @@ _show_detail() { | |||
| 513 | fi | 498 | fi |
| 514 | } | 499 | } |
| 515 | 500 | ||
| 501 | # Open Github repository import page | ||
| 502 | _import_to_github() { | ||
| 503 | _gist_id "$1" || return 1 | ||
| 504 | echo put the folowing URL into web page: | ||
| 505 | echo -n "git@github.com:$GIST_ID.git" | ||
| 506 | python -mwebbrowser https://github.com/new/import | ||
| 507 | } | ||
| 508 | |||
| 509 | # Simply commit current changes and push to remote | ||
| 510 | _push_to_remote() { | ||
| 511 | _gist_id "$1" || return 1 | ||
| 512 | cd "$folder/$GIST_ID" && git add . \ | ||
| 513 | && git commit --allow-empty-message -m '' && git push origin master | ||
| 514 | } | ||
| 515 | |||
| 516 | # Set filename/description/permission for a new gist | 516 | # Set filename/description/permission for a new gist |
| 517 | _set_gist() { | 517 | _set_gist() { |
| 518 | files=() | 518 | files=() |