threads / patch / 43409

patchRe: [PATCH] Bash snippet to show branch and patch in bash prompt

Subject: Re: [PATCH] Bash snippet to show branch and patch in bash prompt

## tl;dr

4 messages between Oct 30, 2006 and Oct 30, 2006. Diffs are folded; open one to read it.

replies: 3people: 2as markdown or json

Robin Rosenberg· Oct 30, 2006, 10:42 UTC · lore

[PATCH] Bash snippet to show branch and patch in bash prompt

From: Robin Rosenberg <robin.rosenberg@dewire.com>
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
---
 contrib/stgbashprompt.sh |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)
Show changes to contrib/stgbashprompt.sh +15 −0
diff --git a/contrib/stgbashprompt.sh b/contrib/stgbashprompt.sh
new file mode 100755
index 0000000..792da53
--- /dev/null
+++ b/contrib/stgbashprompt.sh
@@ -0,0 +1,16 @@
+# include this in your bashrc or copy to /etc/bash_completions.d
+
+if [ "$PS1" ]; then
+    # trap 'PS1="\u@\h [$(stg top)] \w]\$ "' DEBUG
+    function stgtag
+    {
+	br=$(stg branch 2>/dev/null)
+	top=$(stg top 2>/dev/null)
+	if [[ -n "$br$top" ]];then
+	    echo "[$top@$br]"
+	    return
+	fi
+    }
+    PS1='\u@\h$(stgtag)\w\$ '
+
Catalin Marinas· Oct 30, 2006, 10:46 UTC · re: Robin Rosenberg · lore
Robin Rosenberg <robin.rosenberg@dewire.com> wrote:
Show 30 quoted lines
> From: Robin Rosenberg <robin.rosenberg@dewire.com>
>
> Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
> ---
>
>  contrib/stgbashprompt.sh |   16 ++++++++++++++++
>  1 files changed, 16 insertions(+), 0 deletions(-)
>
> diff --git a/contrib/stgbashprompt.sh b/contrib/stgbashprompt.sh
> new file mode 100755
> index 0000000..792da53
> --- /dev/null
> +++ b/contrib/stgbashprompt.sh
> @@ -0,0 +1,16 @@
> +# include this in your bashrc or copy to /etc/bash_completions.d
> +
> +if [ "$PS1" ]; then
> +    # trap 'PS1="\u@\h [$(stg top)] \w]\$ "' DEBUG
> +    function stgtag
> +    {
> +	br=$(stg branch 2>/dev/null)
> +	top=$(stg top 2>/dev/null)
> +	if [[ -n "$br$top" ]];then
> +	    echo "[$top@$br]"
> +	    return
> +	fi
> +    }
> +    PS1='\u@\h$(stgtag)\w\$ '
> +
> +fi
Isn't this the same patch? "stg refresh" :-)?
-- 
Catalin

P.S. could you please send them to my catalin.marinas@gmail.com
Robin Rosenberg· Oct 30, 2006, 10:57 UTC · re: Robin Rosenberg · lore
måndag 30 oktober 2006 11:42 skrev Robin Rosenberg:
> From: Robin Rosenberg <robin.rosenberg@dewire.com>
>
> Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
This was a "reply" using stgit, but the reference missed the ange brackets. 
Anyway thanks for the feedback on the prompt.
-- robin

← back to recent threads