prompt

Color for the PROMPT (just the PROMPT proper) in cmd.exe and PowerShell?

旧时模样 提交于 2019-11-28 21:06:55
问题 So in Bash you just configure PS1 to add colors to your prompt. I'm talking about the prompt proper, not the color of the foreground (text) or the background. And it's really easy in Bash and it helps a lot if you need to find your commands in a sea of messy text output. Can you achieve the same for cmd.exe , or as a fallback, for PowerShell? A colored prompt? I don't know if it could be done in the old days before Win32 by loading ANSI.SYS . I think that was just to make the foreground and

How can I shorten the path of a DOS prompt?

不想你离开。 提交于 2019-11-28 19:53:13
问题 My path on my DOS prompt is ridiculously long. How can I shorten this? C:\RUBY\Ruby_Practice\prep-work-master\coding-test-2\practice-problems\spec> 回答1: Right-click on My Computer|Properties. Then from the Advanced Tab, click Environment Variables, then add a new User Variable called PROMPT and set it to $p$_$+$g . http://www.hanselman.com/blog/ABetterPROMPTForCMDEXEOrCoolPromptEnvironmentVariablesAndANiceTransparentMultiprompt.aspx 回答2: To remove the path from the prompt use 'prompt $g'

To get a prompt which indicates Git-branch in Zsh

时光毁灭记忆、已成空白 提交于 2019-11-28 16:11:14
I run the following codes separately as my prompt unsuccessfully in .zshrc. This suggests me that apparently I do not have a program called __git_ps1. It is not in MacPorts. #1 PROMPT="$(__git_ps1 " \[\033[1;32m\] (%s)\[\033[0m\]")\$"$ #2 PROMPT="$(__git_ps1 " (%s)")\$"$ #3 # Get the name of the branch we are on git_prompt_info() { branch_prompt=$(__git_ps1) if [ -n "$branch_prompt" ]; then status_icon=$(git_status) echo $branch_prompt $status_icon fi } # Show character if changes are pending git_status() { if current_git_status=$(git status | grep 'added to commit' 2> /dev/null); then echo "☠

WPF: Create a dialog / prompt

久未见 提交于 2019-11-28 15:51:48
I need to create a Dialog / Prompt including TextBox for user input. My problem is, how to get the text after having confirmed the dialog? Usually I would make a class for this which would save the text in a property. However I want do design the Dialog using XAML. So I would somehow have to extent the XAML Code to save the content of the TextBox in a property - but I guess that's not possible with pure XAML. What would be the best way to realize what I'd like to do? How to build a dialog which can be defined from XAML but can still somehow return the input? Thanks for any hint! Josh The

What is the difference between PS1 and PROMPT_COMMAND

心不动则不痛 提交于 2019-11-28 15:14:24
While taking a look at this awesome thread I noticed that some examples use PS1="Blah Blah Blah" and some use PROMPT_COMMAND="Blah Blah Blah" (and some use both) when setting the prompt in a bash shell. What is the difference between the two? An SO search and even a bit of broader google searching aren't getting me results, so even a link to the right place to look for the answer would be appreciated. From the GNU Bash doc page: http://www.gnu.org/software/bash/manual/bashref.html PROMPT_COMMAND If set, the value is interpreted as a command to execute before the printing of each primary prompt

WINDOWS PROMPT Getting IP of webpages from file

断了今生、忘了曾经 提交于 2019-11-28 14:45:50
I have to get IP of webpages that I'll deliver from txt file: for example txt file looks like: google.com yahoo.com toyota.com bmw.com etc... I'll have to get something like 81.177.116.172 11.127.114.122 etc.. or 81.177.116.172 - google.com 11.127.114.122 - yahoo.com I know that I can use ping websiteurl.com > ping.txt but i want to check like 2000 pages. Please advice how to do it the fastest way, and how to deliver line from txt file as parameter to ping. Thanks I know this is a PowerShell answer to a batch question, but I find that many people ask how to do things in batch when they are

Changing PS1 prompt in a Bash parent shell

半世苍凉 提交于 2019-11-28 13:54:34
Using a script, I was to change the prompt of the parent Bash shell. I have tried the following: PS1="Hello World > " This changes the prompt of the subshell, which the script is running in, but which command would I use to change the prompt of the parent shell. Any ideas? In all cases the parent shell must cooperate. The child process in a unix environment cannot influence the parent process without its cooperation. Try this in the subshell script changePrompt.sh : echo 'PS1="Hello World > "' And then call the script from the parent shell like this: eval "$(changePrompt.sh)" Or, a different

Different bash prompt for different vi editing mode?

青春壹個敷衍的年華 提交于 2019-11-28 13:40:48
问题 When using vi mode (set -o vi) with Bash, it would be nice to have a prompt that depends on the mode you are currently in (insert or command). How does one find out this editing mode? B.t.w, this seems to be possible in ZSH: 回答1: Fresh bash 4.3 and readline 6.3 have something for you guys.. from the changelog: 4. New Features in Readline j. New user-settable variable, show-mode-in-prompt, adds a characters to the beginning of the prompt indicating the current editing mode. So putting set show

fgets prompt limited to 1024 Bytes

五迷三道 提交于 2019-11-28 13:09:07
I have been struggling with a pretty simple issue writing a little program in C . Getting input (commands, arguments, flags to be executed) via fgets() works fine as long as the size of the input does not exceed 1024 bytes. After 1024 characters are typed, no more characters are accepted -- the prompt just stops. I assume reason for the problem doesn't lay in the fgets() parameters/configuration because otherwise it would at least take the input up to defined size instead of blocking. How can I make fgets() accept lines as long as _SC_LINE_MAX ( 2048 ) bytes/chars? Terminal drivers limit the

How to set Text like Placeholder in JTextfield in swing

夙愿已清 提交于 2019-11-28 12:38:48
I want to put some texts in text-Field when the form is load which instruct to user and when user click on that text-filed the texts remove automatically. txtEmailId = new JTextField(); txtEmailId.setText("Email ID"); i have wrote above code but it display the text and keep as it is when user click on that text button i want to remove it. is there any way to do this task? I use to override the text fields paint method, until I ended up with more custom text fields then I really wanted... Then I found this prompt API which is simple to use and doesn't require you to extend any components. It