Permalink
Browse files

Add fresh-convert script

Converts GitHub URLs to fresh lines.
  • Loading branch information...
1 parent 32c9fa2 commit a9fe7ab35b5b17cda7ca47cf29e06a7a6aef17b0 @twe4ked committed Apr 7, 2013
Showing with 20 additions and 0 deletions.
  1. +20 −0 bin/fresh-convert
View
@@ -0,0 +1,20 @@
+#!/bin/bash -e
+#
+# example usage:
+#
+# fresh convert https://github.com/twe4ked/dotfiles/blob/master/bin/fresh-convert --bin
+
+if [[ -z "$1" ]]; then
+ echo "usage: fresh convert [GitHub URL] [fresh options]" >&2
+ exit 1
+fi
+
+fresh_line="$(echo "$1" | sed -e 's#^https://github.com/#fresh #' -e 's#/blob/master/# #')"
+
+shift
+
+for arg in "$@"; do
+ fresh_line="$fresh_line $arg"
+done
+
+echo "$fresh_line"

0 comments on commit a9fe7ab

Please sign in to comment.