Compare commits

..

142 Commits

Author SHA1 Message Date
638d82e989 Update CHANGELOG.md 2020-01-08 21:43:09 -05:00
0e37a4c2f9 Merge pull request #2222 from daxgames/1.3.14
1.3.14
2020-01-08 21:34:19 -05:00
ca2550b70e Fix issue #2214 2020-01-06 23:03:11 -05:00
492fc284f2 Fix issue #2214 2020-01-06 22:57:29 -05:00
ec06f3e39b changelog 2020-01-06 22:50:03 -05:00
850e4ec045 Merge pull request #2237 from jrappen/patch-1
Bump git-for-windows to v2.24.1.windows.2
2020-01-06 22:40:49 -05:00
fe3d2034ef Bump git-for-windows to v2.24.1.windows.2 2020-01-06 22:45:17 +01:00
180e72a6aa revert --no-log to fix windows 7 clink prompt 2020-01-05 13:52:23 -08:00
93cf865071 post-install fixes 2020-01-05 16:41:02 -05:00
b41aac982c Merge pull request #2223 from vladimir-kotikov/patch-6
Update clink-completions
2019-12-05 13:23:36 -05:00
8df688bada Update clink-completions
https://github.com/vladimir-kotikov/clink-completions/releases/tag/0.3.5
2019-12-05 10:53:32 +03:00
84917159ec fixes for cmd:cmder init script 2019-12-04 16:14:36 -05:00
750560851f fixes for cmd:cmder init script 2019-12-04 16:13:08 -05:00
9b29668250 fixes for cmd:cmder init script 2019-12-04 16:09:38 -05:00
a857d8419c fixes for cmd:cmder init script 2019-12-04 16:04:16 -05:00
0cf1c5e2eb fix 2019-11-23 18:13:03 -05:00
ddec3e8425 Merge pull request #2212 from daxgames/goo_per_shell
dd per shell git opt out
2019-11-23 11:59:25 -05:00
2428e8529f dd per shell git opt out 2019-11-23 11:54:53 -05:00
3eb82d4095 Merge pull request #2203 from daxgames/conemu191012
update conemu to 19.10.12
2019-11-19 17:21:05 -05:00
589b48d06e update conemu 2019-11-09 17:50:57 -05:00
67f35bc05d Merge pull request #2199 from daxgames/git_opt_out
Git opt out
2019-11-09 17:03:07 -05:00
9724151f06 allow git prompt status opt out for powershell and bash 2019-11-09 16:40:55 -05:00
c04cc6dc7f allow git prompt status opt out for powershell and bash 2019-11-09 16:39:57 -05:00
3ee244e4c1 allow git prompt status opt out for powershell and bash 2019-11-09 16:36:16 -05:00
44bc089ee4 move lambda to cmder prompt method for easier user change 2019-11-03 14:14:47 -05:00
6ab4599a4d separate powershell functions from profile.ps1 2019-11-03 13:07:20 -05:00
dac4b27e28 separate powershell functions from profile.ps1 2019-11-03 12:59:36 -05:00
661f59d0fb Fix #2191 profile.ps1: CheckGit does not export $gitLoaded 2019-11-03 12:36:28 -05:00
5a6f873d2b README.md 2019-11-03 11:29:18 -05:00
788d4e0caa README.md 2019-11-03 11:28:18 -05:00
f1fbd98093 README.md 2019-11-03 11:25:02 -05:00
74fcb5b62b README.md 2019-11-03 11:23:37 -05:00
60279fea04 README.md 2019-11-03 11:22:29 -05:00
7877d417f8 changelog 2019-11-03 11:13:55 -05:00
44a8bf5802 add ability to disable git 2019-11-03 11:00:27 -05:00
b70a03cde0 Merge pull request #2194 from daxgames/fix_path_with!
Fix path with ! in cmder_root dir path
2019-11-01 17:19:03 -04:00
8cf51e454a CHANGELOG.md 2019-10-27 17:06:02 -04:00
f1b1ac0ec1 CHAMGELOG.md 2019-10-27 16:57:28 -04:00
06b0c0d3c2 cleanup 2019-10-27 16:43:51 -04:00
f1a9721256 Update init.bat 2019-10-22 22:44:17 -04:00
46c8099317 Update CHANGELOG.md 2019-10-22 22:41:44 -04:00
f44c68273b Merge pull request #2193 from glucas/fix/2192
Fix #2192: Set default prompt hooks before loading user profile
2019-10-22 21:45:32 -04:00
7f69f15637 Fix #2192: Set default prompt hooks before loading user profile 2019-10-22 11:17:13 -04:00
3736508b2c Update template issue (#2189)
* fix unclear guide

* m. update
2019-10-14 19:37:55 +02:00
4575ac3209 ⬆️ Update ConEmu to 190714
Release Notes: https://conemu.github.io/en/Whats_New.html
2019-10-12 19:45:23 +02:00
035f209bc4 ⬆️ Update Git to 2.23.0
Release Notes: https://github.com/git-for-windows/git/releases/tag/v2.23.0.windows.1
2019-10-12 19:43:46 +02:00
e4651cf7b4 Bare doubledash for conemu commands (#2174)
* Add bare doubledash command line option

The '--' parameter is a common POSIX-style option.  All command-line parameters after the double dash will be joined by a space and forwarded to conemu.

* add bare doubledash command line option

The "--" option indicates that the remaining portion of the command line is forwarded to conemu. Quotes and spacing is retained.

* move all doubledash related code together

* remove unused variable
2019-10-06 21:52:50 +01:00
19a2fd11e3 Clink Completions 0.3.4 (#2177)
* update Changelog, clink-completions 0.3.4, fix ps fg color

* Update CHANGELOG.md

* Update CHANGELOG.md
2019-09-28 02:21:47 +02:00
feee4eaed2 Merge pull request #2153 from mcovalt/clink_nolog
Disable clink logging
2019-09-14 09:13:04 -04:00
b310a2c47c Disable clink logging 2019-08-29 12:48:52 -04:00
22afc40a08 cleanup 2019-08-22 06:27:39 -04:00
c499456f97 cleanup 2019-08-22 06:24:49 -04:00
34468ef2fd cleanup 2019-08-22 06:20:19 -04:00
5cb8021864 Merge branch 'fix_path_with!' of https://github.com/daxgames/cmder into fix_path_with! 2019-08-22 06:11:18 -04:00
468dba474e fixes 2019-10-13 15:47:25 -04:00
db42252ef2 cleanup 2019-10-13 10:18:04 -04:00
57b328b209 cleanup 2019-10-13 10:15:26 -04:00
05836e761e merge 2019-10-13 10:11:38 -04:00
e8b33aa45b Merge branch 'master' of https://github.com/cmderdev/cmder into fix_path_with! 2019-10-13 10:11:25 -04:00
377d97e56a fix path with ! in dir 2019-10-13 10:07:23 -04:00
3a44bc809d add ~ match to vendor/clink.lua/ 2019-09-27 18:17:24 -04:00
45e5600249 update Changelog, clink 0.3.4, fix ps fg color 2019-09-26 18:07:25 -04:00
ff595e62b1 Merge pull request #2144 from daxgames/1.3.12
1.3.12 Release
2019-08-18 18:33:40 -04:00
a85a208b20 CHANGELOG.md 2019-08-18 18:26:21 -04:00
ecda3acfdf Update CHANGELOG.md 2019-08-18 17:49:56 -04:00
5477b7812d Re-arrange CHANGELOG.md. 2019-08-18 17:39:29 -04:00
81951a4a14 Merge branch 'master' of https://github.com/cmderdev/cmder 2019-08-18 16:33:43 -04:00
0280593d4c Merge pull request #2123 from daxgames/alias
CHANGELOG.md
2019-07-07 14:06:57 -04:00
f8e859f844 changelog 2019-07-07 14:05:14 -04:00
af4c1fddbb Merge pull request #2122 from daxgames/alias
restore old alias.cmd without 'create' option
2019-07-07 13:56:18 -04:00
b58b3b4547 restore old alias.cmd without 'create' option 2019-07-07 13:52:34 -04:00
9184f8e2bf Merge branch 'master' of https://github.com/cmderdev/cmder into alias 2019-07-07 13:32:47 -04:00
1e0e2193e0 Merge branch 'master' into alias 2019-07-07 13:31:13 -04:00
38fd3468fe restore old alias.cmd without 'create' option 2019-07-07 13:30:34 -04:00
ebd977778b Merge pull request #2113 from SupinePandora43/vscode
vscode.bat
2019-06-27 08:27:37 -04:00
72dd8376cd move
https://github.com/cmderdev/cmder/pull/2113#issuecomment-506044156
2019-06-27 16:00:55 +05:00
b61752f89e vscode.bat
add that to settings.json

`"terminal.integrated.shell.windows": "cmd.exe",
"terminal.integrated.shellArgs.windows": [
    "/K",
    "%CMDER_ROOT%/vscode.bat",
]`

for using cmder inside vscode
2019-06-25 12:37:57 +04:00
8f59d529f4 Update stale comments 2019-06-20 10:12:12 +01:00
711c436f04 Merge branch 'master' of https://github.com/cmderdev/cmder 2019-06-09 16:18:38 -04:00
ea531cdd44 Fix post-install.bat not running and deleting itself (#2106)
* Fix post-install.bat not running

* Changelog

* Changelog
2019-06-03 11:23:00 +01:00
73c21d1a59 Wrap labels with quotes 2019-05-24 13:54:09 +01:00
a97ce1f950 Create stale.yml 2019-05-24 13:47:01 +01:00
4510abb3c8 Merge pull request #2096 from eziosella/pull-request-2094-pars-forwarding
Add `/x "CONEMU ARGS"` command line argument.
2019-05-22 08:30:18 -07:00
6d132c2665 Merge pull request #2099 from warthurton/patch-1
Update README.md
2019-05-22 08:27:53 -07:00
543c7ca6e9 Replace /FWPARS argument with /X as "daxgames" request. 2019-05-19 22:54:47 +02:00
efc978f6f8 Update README.md
Added /t switch for timed init mode.
2019-05-16 15:13:07 -04:00
5def1c584a Add FWPARS cmdline argument.
This argument forwards parameters to ConEmu app.

	e.g. Cmder.exe /FWPARS "-min -tsa"

In this case Cmder will start minimized on TaskBar
2019-05-12 15:18:15 +02:00
865e443fcd Merge pull request #2068 from cmderdev/history_cmd_index_sync
Print Index in History Command Output
2019-05-05 17:28:07 -04:00
893207453d CHANGELog 2019-05-05 17:27:25 -04:00
5e5e0ece73 CHANGELog 2019-05-05 17:25:47 -04:00
834f031442 Merge branch 'master' of https://github.com/daxgames/cmder into history_cmd_index_sync 2019-05-05 17:19:49 -04:00
0bd847e695 Merge pull request #2083 from JoshuaWebb/master
Close file handles in clink.lua
2019-05-05 17:13:57 -04:00
efe64ee6fd Merge pull request #2072 from daxgames/alias
Alias
2019-05-05 17:12:13 -04:00
5f9f3560c8 fix commnd line help 2019-05-05 17:11:31 -04:00
9b9bb13f6a fix commnd line help 2019-05-05 17:06:44 -04:00
52eea5fe9f Close file handles in clink.lua 2019-04-19 16:16:45 +10:00
ab3f0b76fb fixes 2019-04-01 22:17:53 -04:00
528bbea7f5 fixes 2019-04-01 22:10:21 -04:00
f20eca01ac fixes 2019-04-01 17:34:00 -04:00
26d8d58e77 Merge branch 'master' of https://github.com/cmderdev/cmder into alias 2019-04-01 17:32:57 -04:00
cf134604bb fixes 2019-04-01 17:31:46 -04:00
67b374ad37 revert alias.cmd changes 2019-04-01 17:09:05 -04:00
d592f80364 Merge branch 'master' of https://github.com/cmderdev/cmder into alias 2019-04-01 17:04:03 -04:00
3e40c80331 new alias create syntax 2019-04-01 16:58:45 -04:00
ac2082d56d Merge pull request #2060 from daxgames/ps1_prompt
Fixes and More Cmder Like Powershell
2019-04-01 15:20:37 -04:00
a813e359c5 don't delete aliases by default but provide an easy way for users to do so. 2019-04-01 09:09:32 -04:00
345562dbd0 Merge branch 'ps1_prompt' of https://github.com/daxgames/cmder into ps1_prompt 2019-03-31 16:48:10 -04:00
13de4924ca make powershell use of bash commands more bash like 2019-03-31 16:47:36 -04:00
f39b921121 fixes 2019-03-31 16:11:14 -04:00
43d5a7b833 Merge branch 'master' of https://github.com/cmderdev/cmder into history_cmd_index 2019-03-31 16:04:53 -04:00
b424012a08 make debug messages more verbose 2019-03-31 09:48:58 -04:00
192c2f4dd1 fix git detection 2019-03-31 09:47:50 -04:00
4622aa87e4 Merge branch 'master' of https://github.com/cmderdev/cmder into ps1_prompt 2019-03-23 15:05:05 -04:00
0b2c9bf005 Merge branch 'ps1_prompt' of https://github.com/daxgames/cmder into ps1_prompt 2019-03-23 15:04:06 -04:00
081624d88e cleanup 2019-03-23 15:03:44 -04:00
280bbfff1f update issue template (#2062) 2019-03-20 22:57:13 +01:00
a93fff6798 Update init.bat 2019-03-17 15:09:02 -04:00
8abfa9d413 add back shell context menu to drives on register unregister 2019-03-16 19:15:36 -04:00
98a64b71b2 Allow full ps1 prompt customization by 'config/*.ps1' scripts 2019-03-16 13:52:47 -04:00
f2b26352b4 Merge branch 'master' of https://github.com/cmderdev/cmder 2019-03-12 21:12:42 -04:00
63128ed52f polished issues template (#2056)
- added version subsection
- better worded upstream technologies notice
- more clear instructions
2019-03-07 14:29:46 +01:00
036efc2fb8 Merge branch 'master' of https://github.com/cmderdev/cmder 2019-03-03 07:08:10 -05:00
2582891307 Merge branch 'master' of https://github.com/cmderdev/cmder 2019-03-01 19:54:14 -05:00
ec42046297 Merge pull request #2017 from b0bh00d/master
Replaced 'hg id -ib'
2019-03-01 14:00:22 -05:00
522656845f Merge pull request #2041 from cmderdev/upate_readme
Update README.md
2019-03-01 13:58:40 -05:00
6b22a5c583 Merge pull request #2055 from daxgames/git_clink_changes
Git and Clink changes
2019-03-01 13:57:32 -05:00
e75958b881 Merge branch 'master' of https://github.com/cmderdev/cmder 2019-03-01 13:47:03 -05:00
8ec252276f changelog 2019-02-28 18:13:19 -05:00
16bf572cdf Merge branch 'master' of github.com:cmderdev/cmder into git_clink_changes 2019-02-28 18:03:58 -05:00
7bd25e95e1 upgrade git to 2.21.0 2019-02-28 17:55:16 -05:00
cc12b848ac provide default settings for clink that updates the history file in real time 2019-02-28 17:44:28 -05:00
20d55c1469 all clink disable by setting CMDER_CLINK=0 befor starting task 2019-02-28 17:37:45 -05:00
06e6c63b7f Update README.md 2019-02-18 11:41:11 -05:00
89499f2a60 Replaced the 'hg -id' command with the 'hg branch' and 'hg status' pair for improved response times. 2019-01-20 21:02:31 -07:00
95e5169476 Merge remote-tracking branch 'upstream/master' 2019-01-20 20:50:09 -07:00
760f4e579e ignore all /d arg if running inside vscode 2019-01-06 18:09:06 -05:00
6d8f7a290a ignore all args if running inside vscode 2019-01-06 17:46:50 -05:00
2a4e9d8301 workaround vscode tasks showing cmder debug output 2019-01-06 17:27:04 -05:00
961f38a399 Updated the HG prompt (#2002)
Per our email discussion, I have updated the HG prompt code to use the '-ib' option to 'hg id' so the branch name is always available, regardless of the state of the working copy.
2019-01-05 19:56:30 +01:00
5a48e568a8 Updated the HG prompt code to use the '-ib' option to 'hg id' to always have the branch name available. 2019-01-01 11:17:53 -07:00
d8444dae97 Set history_io=3 in default Clink settings
Currently the "history" command in Cmder prints commands without any index associated with any command, so you can copy/paste a command or use "!!" to execute a command from the history but, unlike BASH, you can't do "!<command_index>".

"cat" has a switch, "-n", which prints line numbers of the file being printed. This, in conjunction with "history_io=3" in Clink settings (to read/write history when editing a command") works just like BASH, i.e., you can use the index printed next to a command in the history to execute that command as "!<command_index>".
2017-03-17 10:59:12 +08:00
0a5d1ac156 Use cat -n for printing history to show cmd index
Currently the "history" command in Cmder prints commands without any index associated with any command, so you can copy/paste a command or use "!!" to execute a command from the history but, unlike BASH, you can't do "!<command_index>".

"cat" has a switch, "-n", which prints line numbers of the file being printed. This, in conjunction with "history_io=3" in Clink settings (to read/write history when editing a command") works just like BASH, i.e., you can use the index printed next to a command in the history to execute that command as "!<command_index>".
2017-03-17 10:26:57 +08:00
21 changed files with 860 additions and 345 deletions

View File

@ -2,71 +2,101 @@
Thank you for reporting a bug for the Cmder project!
------------------------------------------------------------------
Please make sure you read and follow the following instructions
carefully before reporting bugs, and/or requesting new features.
Make sure that you have:
• Searched for existing issues (including the **closed** ones)
for the similar problems here:
https://github.com/cmderdev/cmder/issues?q=is:issue
• Read the README.md and the Wiki:
• Read both the README.md and the Wiki:
- https://github.com/cmderdev/cmder/blob/master/README.md
- https://github.com/cmderdev/cmder/wiki
(What you may be asking here could already be explained there!)
• Please understand that Cmder by default uses ConEmu as the
underlying Terminal Emulator. If your issue is regarding
• Please understand that Cmder uses ConEmu as the default
underlying Terminal Emulator. If your issue is regarding
the **Terminal Emulator**, please visit the ConEmu issues page:
https://github.com/Maximus5/ConEmu/issues?q=is:issue
If there isn't an existing issue, you may open a new one there.
(We don't resolve issues regarding ConEmu here, so please
(We don't resolve issues regarding ConEmu here, so please
make sure you open the issue in the correct place.)
more info: https://conemu.github.io/en/ThirdPartyProblems.html
• If you are asking for guides on how to integrate Cmder into
your favorite IDE of choice, or how to perform an specific
task with Cmder, make sure you visit our label section first!
• If you would like to ask for guides on how to integrate Cmder with
your favorite IDE of choice, or how to perform a specific task
with Cmder, make sure you visit our label section first.
You may already have an answer under the Guides or Questions section.
For a list of labels, visit:
- https://github.com/cmderdev/cmder/labels
(Be sure to also check “Closed” issues in the labels section!)
• If the issue is regarding the other upstream technologies that
Cmder uses (e.g. Clink, Git, etc), please make sure that the
bug you are reporting only applies when they are used in
combination with Cmder. If the bug applies when the mentioned
tools are NOT used within Cmder, there's a good chance that
you should open the bug at the corresponding repo instead.
• If you have a request to provide auto-complete support for a new tool,
please post your request here:
https://github.com/vladimir-kotikov/clink-completions/issues
• If you are having an issue with any of the **upstream technologies**
that are used by Cmder, please make sure that the issue is reproducible
_only_ when used in combination with Cmder.
We may not directly address the issues related to the following tools:
- Clink, the default shell in Cmder
- ConEmu, the terminal emulator
- Git/MinGW, which also provide *NIX tools
- clink-completions, which provide autocompletion
The issues related to upstream technologies are labeled as 👆 [name].
We'll try our best to help you -- but we recommend creating an issue
specifically at each of the corresponding repositories for the best
result.
► Try to reproduce the bug you're reporting, on a stand-alone edition
of each tool, without using Cmder. If the bug applies when the
mentioned tools are NOT used within Cmder, there's a good chance that
you should open the bug at the corresponding repo instead.
• Lastly, have a look at official documentation for Cmder over
our website, and our wiki.
Read more on about Cmder on ConEmu docs:
https://conemu.github.io/en/cmder.html
Thank you for making sure you are opening a new valid issue!
Thank you for making sure you are opening a new valid issue!
-->
<!--
<!--
Some tips on how to write a better report:
- Put an `x` into all the boxes [ ] relevant to your issue (example: [x]).
- Put an `x` into all the boxes [ ] relevant to your issue (correct example: [x] -- not like this: [ x] or [x ]).
- Any text that is between the the commment tags will get ignored, e.g.: <!-- this will NOT work -- >
You need to write your text either outside the tags, or the line below it.
- Use the *Preview* tab to see how your issue will actually look like, before sending it.
⚠ If for some reason you can not see the text you just wrote, make sure you've read the instructions clearly
- Make sure the description is worded well enough to be understood, and with as much context and examples as possible.
- Post a screenshot or the command the triggered the problem, if applicable.
- Avoid using ambiguous phrases like: doesn't work, there'a problem, etc.
Help us reproduce the issue by explaining what went wrong, and what did you expect to happen.
- Please keep the ticket language to English only here.
We can't process your issue if it's written in Russian or Chinese as we can't understand them.
- You can find the version of Cmder.exe and ConEmu.exe binaries using Right Click → Properties → Details menu.
- ⚠ Read the following page to avoid posting a bad issue: https://conemu.github.io/en/BadIssue.html
- Failure to follow these guidelines may result in your issue getting closed. So please follow it carefully!
-->
### Purpose of the issue
@ -74,5 +104,10 @@
- [ ] Feature request (request for new functionality)
- [ ] Question
### Description of the issue
<!-- Provide a clear, simple description of your issue here -->
### Version Information
<!-- Please write your Cmder and ConEmu version below this line -->
<!-- If applicable, write down your Windows edition too below this line (e.g. Windows 10 Pro 1903) -->
### Description of the issue
<!-- Provide a clear, simple description of your issue below this line -->

19
.github/stale.yml vendored Normal file
View File

@ -0,0 +1,19 @@
# Number of days of inactivity before an issue becomes stale
daysUntilStale: 30
# Number of days of inactivity before a stale issue is closed
daysUntilClose: 7
# Issues with these labels will never be considered stale
exemptLabels:
- "📌 Pinned"
# Label to use when marking an issue as stale
staleLabel: "👀 Awaiting Response"
# Comment to post when marking an issue as stale. Set to `false` to disable
markComment: >
This issue has been automatically marked as stale because it has not had
any recent activity. It will be closed in a week if no further activity occurs.
Thank you for your contribution(s).
# Comment to post when closing a stale issue. Set to `false` to disable
closeComment: >
This issue has been automatically closed due to it not having any
activity since it was marked as stale.
Thank you for your contribution(s).

2
.gitignore vendored
View File

@ -8,7 +8,7 @@ vendor/*/*
!vendor/bin/*
!vendor/lib/*
!vendor/*
!vendor/psmodules/PsGet
!vendor/psmodules/*
config/*
!config/Readme.md

View File

@ -1,5 +1,90 @@
# Change Log
## [1.3.14](https://github.com/cmderdev/cmder/tree/v1.3.14) (2020-01-08)
### Fixes
* Pull Request: [#2222](https://github.com/cmderdev/cmder/pull/2222)
* Cmder v1.3.13 init script fails. [#2218](https://github.com/cmderdev/cmder/issues/2218)
* Git & env related error messages. [#2220](https://github.com/cmderdev/cmder/issues/2220)
* Latest addition of "--nolog" clink breaks cmd prompts. [#2166](https://github.com/cmderdev/cmder/issues/2166)
* `/nix_tools 0` should prevent adding `%GIT_INSTALL_ROOT%\mingw64\bin` to PATH. [#2214](https://github.com/cmderdev/cmder/issues/2214)
### Changes
* Update Git for Windows to 2.24.1.windows.2
* Pull Request: [#2237](https://github.com/cmderdev/cmder/pull/2237)
* Update clink-completions to 0.3.5
* Pull Request: [#2223](https://github.com/cmderdev/cmder/pull/2223)
## [1.3.13](https://github.com/cmderdev/cmder/tree/v1.3.13) (2019-11-03)
### Changes
* Update to Conemu 19.10.12
### Adds
* #2197, #1364, #447 Add ability to disable git status either globally or for individual repos.
* To disable git status globally add the following to `~/.gitconfig` or locally for a single repo `[repo]/.git/config`:
```
[cmder]
status = false
```
* #2174 `--` Syntax to pass command line options to Conemu.
* Disable Clink Logging
* Add `~` tab completion.
### Fixes
* Fix #2191: profile.ps1: CheckGit does not export $gitLoaded
* Fix #2192: Set default prompt hooks before loading user profile
* Fix #2097, #1899: powershell foreground color changing to green
* Fix #1979: Update Clink Completions to 0.3.4
* Fix #1678: Cmder corrupting path with `!` in Cmder folder path.
## [1.3.12](https://github.com/cmderdev/cmder/tree/v1.3.12) (2019-08-19)
### Fixes
* Pull Request: [#2113](https://github.com/cmderdev/cmder/pull/2113)
* Add `vendor\bin\vscode_init.cmd` for use with Visual Studio Code
* Fixes [#2118](https://github.com/cmderdev/cmder/issues/2118)
* Fixes [#1985](https://github.com/cmderdev/cmder/issues/1985)
* Pull Request: [#2106](https://github.com/cmderdev/cmder/pull/2106)
* Portable Git requires running `post-install.bat` which deletes itself when done. This was not happening.
* Resolves [#2105](https://github.com/cmderdev/cmder/issues/2105)
* Pull Request: [#2002](https://github.com/cmderdev/cmder/pull/2002)
* Updated the HG prompt code to use the '-ib' option to 'hg id' so the branch name is always available, regardless of the state of the working copy
### Changes
* Pull Request: [#2055](https://github.com/cmderdev/cmder/pull/2055)
* Upgrade git to 2.21.0
* Provide default settings for Clink that updates the history file in real time
* Turn this on in existing Cmder using `clink set history_io 1`
* Allow clink disable by setting CMDER_CLINK=0 before starting task
* Pull Request: [#2068](https://github.com/cmderdev/cmder/pull/2068)
* Print Index in History Command Output.
* Sets default `history_expand_mode = 3` in initial Clink Settings.
### Adds
* Pull Request : [#2096](https://github.com/cmderdev/cmder/pull/2096)
* Question issue: [#2094](https://github.com/cmderdev/cmder/issues/2094)
* New argument created to ConEmu forwarding arguments.
* Syntax: `/x [ConEmu extras arguments]`
* e.g.: `Cmder.exe /x "-min -tsa"`
* Pull Request: [#2072](https://github.com/cmderdev/cmder/pull/2072)
* New alias create [alias] [alias command] syntax
* Based on [#1750](https://github.com/cmderdev/cmder/pull/1750)
* Syntax: `alias create [alias] [alias command]`
## [1.3.11](https://github.com/cmderdev/cmder/tree/v1.3.11) (2018-12-22)
### Fixes

View File

@ -50,6 +50,7 @@ The Cmder's user interface is also designed to be more eye pleasing, and you can
| `/SINGLE` | Start Cmder in single mode. |
| `/START [start_path]` | Folder path to start in. |
| `/TASK [task_name]` | Task to start after launch. |
| `/X [ConEmu extras pars]` | Forwads parameters to ConEmu |
## Context Menu Integration
@ -91,8 +92,8 @@ _(Some shortcuts are not yet documented, though they exist - please document the
### Access to multiple shells in one window using tabs
You can open multiple tabs each containing one of the following shells:
| Task | Shell | Description |
| ---- | ----- | ----------- |
| Task | Shell | Description |
| ---- | ----- | ----------- |
| Cmder | `cmd.exe` | Windows `cmd.exe` shell enhanced with Git, Git aware prompt, Clink (GNU Readline), and Aliases. |
| Cmder as Admin | `cmd.exe` | Administrative Windows `cmd.exe` Cmder shell. |
| PowerShell | `powershell.exe` | Windows PowerShell enhanced with Git and Git aware prompt . |
@ -146,6 +147,7 @@ You may find some Monokai color schemes for mintty to match Cmder [here](https:/
| `/c [user cmder root]` | Enables user bin and config folders for 'Cmder as admin' sessions due to non-shared environment. | not set |
| `/d` | Enables debug output. | not set |
| `/f` | Enables Cmder Fast Init Mode. This disables some features, see pull request [#1492](https://github.com/cmderdev/cmder/pull/1942) for more details. | not set |
| `/t` | Enables Cmder Timed Init Mode. This displays the time taken run init scripts | not set |
| `/git_install_root [file path]` | User specified Git installation root path. | `%CMDER_ROOT%\vendor\Git-for-Windows` |
| `/home [home folder]` | User specified folder path to set `%HOME%` environment variable. | `%userprofile%` |
| `/max_depth [1-5]` | Define max recurse depth when adding to the path for `%cmder_root%\bin` and `%cmder_user_bin%` | 1 |
@ -162,17 +164,31 @@ Single user portable configuration is possible using the cmder specific shell co
| ------------- | ----------------------------------------- |
| Cmder | `%CMDER_ROOT%\config\user_profile.cmd` |
| PowerShell | `$ENV:CMDER_ROOT\config\user_profile.ps1` |
| Bash/Mintty | `$CMDER_ROOT/config/user_profile.sh` |
| Bash/Mintty | `$CMDER_ROOT/config/user_profile.sh` |
Note: Bash and Mintty sessions will also source the `$HOME/.bashrc` file if it exists after it sources `$CMDER_ROOT/config/user_profile.sh`.
You can write `*.cmd|*.bat`, `*.ps1`, and `*.sh` scripts and just drop them in the `%CMDER_ROOT%\config\profile.d` folder to add startup config to Cmder.
| Shell | Cmder `Profile.d` Scripts |
| ------------- | --------------------------------------------------|
| Cmder | `%CMDER_ROOT%\config\profile.d\*.bat and *.cmd` |
| PowerShell | `$ENV:CMDER_ROOT\config\profile.d\*.ps1` |
| Bash/Mintty | `$CMDER_ROOT/config/profile.d/*.sh` |
| Shell | Cmder `Profile.d` Scripts |
| ------------- | -------------------------------------------------- |
| Cmder | `%CMDER_ROOT%\config\profile.d\*.bat and *.cmd` |
| PowerShell | `$ENV:CMDER_ROOT\config\profile.d\*.ps1` |
| Bash/Mintty | `$CMDER_ROOT/config/profile.d/*.sh` |
#### Git Status Opt-Out
To disable Cmder prompt git status globally add the following to `~/.gitconfig` or locally for a single repo `[repo]/.git/config` and start a new session.
*Note: This configuration is not portable*
```
[cmder]
status = false # Opt out of Git status for 'ALL' Cmder supported shells.
cmdstatus = false # Opt out of Git status for 'Cmd.exe' shells.
psstatus = false # Opt out of Git status for 'Powershell.exe and 'Pwsh.exe' shells.
shstatus = false # Opt out of Git status for 'bash.exe' shells.
```
### Aliases
#### Cmder(`Cmd.exe`) Aliases
@ -312,11 +328,11 @@ For instructions on how to integrate Cmder with your IDE, please read our [Wiki
The process of upgrading Cmder depends on the version/build you are currently running.
If you have a `[cmder_root]/config/user-conemu.xml`, you are running a newer version of Cmder, follow the below process:
If you have a `[cmder_root]/config/user[-|_]conemu.xml`, you are running a newer version of Cmder, follow the below process:
1. Exit all Cmder sessions and relaunch `[cmder_root]/cmder.exe`, this backs up your existing `[cmder_root]/vendor/conemu-maximus5/conemu.xml` to `[cmder_root]/config/user-conemu.xml`.
1. Exit all Cmder sessions and relaunch `[cmder_root]/cmder.exe`, this backs up your existing `[cmder_root]/vendor/conemu-maximus5/conemu.xml` to `[cmder_root]/config/user[-|_]conemu.xml`.
* The `[cmder_root]/config/user-conemu.xml` contains any custom settings you have made using the 'Setup Tasks' settings dialog.
* The `[cmder_root]/config/user[-|_]conemu.xml` contains any custom settings you have made using the 'Setup Tasks' settings dialog.
2. Exit all Cmder sessions and backup any files you have manually edited under `[cmder_root]/vendor`.
@ -325,9 +341,9 @@ If you have a `[cmder_root]/config/user-conemu.xml`, you are running a newer ver
3. Delete the `[cmder_root]/vendor` folder.
4. Extract the new `cmder.zip` or `cmder_mini.zip` into `[cmder_root]/` overwriting all files when prompted.
If you do not have a `[cmder_root]/config/user-conemu.xml`, you are running an older version of cmder, follow the below process:
If you do not have a `[cmder_root]/config/user[-|_]conemu.xml`, you are running an older version of cmder, follow the below process:
1. Exit all Cmder sessions and backup `[cmder_root]/vendor/conemu-maximus5/conemu.xml` to `[cmder_root]/config/user-conemu.xml`.
1. Exit all Cmder sessions and backup `[cmder_root]/vendor/conemu-maximus5/conemu.xml` to `[cmder_root]/config/user[-|_]conemu.xml`.
2. Backup any files you have manually edited under `[cmder_root]/vendor`.

View File

@ -3,13 +3,14 @@
All config files must be in this folder. If there is no option to set this folder
directly, it has to be hardlinked.
* `user-aliases.cmd`: aliases in cmd; called from vendor\init.bat; autocreated from
`vendor\user-aliases.cmd.default`.
* `user_aliases.cmd`: aliases in cmd; called from vendor\init.bat; autocreated from
`vendor\user_aliases.cmd.default`.
* `*.lua`: clink completions and prompt filters; autoloaded after all
prompt filter and clink completions are initialized; add your own.
* `user-profile.{sh|cmd|ps1}`: startup files for bash|cmd|powershell tasks; called from their
* `user_profile.{sh|cmd|ps1}`: startup files for bash|cmd|powershell tasks; called from their
respective startup scripts in `vendor\`; autocreated from
`vendor\user-profile.{sh|cmd|ps1}.default` on first start of such a task.
`vendor\user_profile.{sh|cmd|ps1}.default` on first start of such a task.
* `.history`: the current commandline history; autoupdated on close.
* `settings`: settings for readline; overwritten on update.
* `ConEmu.xml`: settings from ConEmu (=the UI of cmder -> Preferences); overwritten on update.
* `user-ConEmu.xml`: settings from ConEmu the UI of Cmder. ;
Do not edit this file directly it is overwritten on each cmder.exe launch.

View File

@ -20,6 +20,8 @@
#define MB_TITLE L"Cmder Launcher"
#define SHELL_MENU_REGISTRY_PATH_BACKGROUND L"Directory\\Background\\shell\\Cmder"
#define SHELL_MENU_REGISTRY_PATH_LISTITEM L"Directory\\shell\\Cmder"
#define SHELL_MENU_REGISTRY_DRIVE_PATH_BACKGROUND L"Drive\\Background\\shell\\Cmder"
#define SHELL_MENU_REGISTRY_DRIVE_PATH_LISTITEM L"Drive\\shell\\Cmder"
#define streqi(a, b) (_wcsicmp((a), (b)) == 0)
@ -69,7 +71,7 @@ bool FileExists(const wchar_t * filePath)
return false;
}
void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstring taskName = L"", std::wstring cfgRoot = L"", bool use_user_cfg = true)
void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstring taskName = L"", std::wstring cfgRoot = L"", bool use_user_cfg = true, std::wstring conemu_args = L"")
{
#if USE_TASKBAR_API
wchar_t appId[MAX_PATH] = { 0 };
@ -96,6 +98,7 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr
std::wstring cmderStart = path;
std::wstring cmderTask = taskName;
std::wstring cmderConEmuArgs = conemu_args;
std::copy(cfgRoot.begin(), cfgRoot.end(), userConfigDirPath);
userConfigDirPath[cfgRoot.length()] = 0;
@ -389,6 +392,11 @@ void StartCmder(std::wstring path = L"", bool is_single_mode = false, std::wstr
swprintf_s(args, L"%s -loadcfgfile \"%s\"", args, userConEmuCfgPath);
}
if (!streqi(cmderConEmuArgs.c_str(), L""))
{
swprintf_s(args, L"%s %s", args, cmderConEmuArgs.c_str());
}
SetEnvironmentVariable(L"CMDER_ROOT", exeDir);
if (wcscmp(userConfigDirPath, configDirPath) != 0)
{
@ -525,6 +533,7 @@ struct cmderOptions
std::wstring cmderStart = L"";
std::wstring cmderTask = L"";
std::wstring cmderRegScope = L"USER";
std::wstring cmderConEmuArgs = L"";
bool cmderSingle = false;
bool cmderUserCfg = true;
bool registerApp = false;
@ -618,6 +627,23 @@ cmderOptions GetOption()
}
}
}
/* Used for passing arguments to conemu prog */
else if (_wcsicmp(L"/x", szArgList[i]) == 0)
{
cmderOptions.cmderConEmuArgs = szArgList[i + 1];
i++;
}
/* Bare double dash, remaining commandline is for conemu */
else if (_wcsicmp(L"--", szArgList[i]) == 0)
{
std::wstring cmdline = std::wstring(GetCommandLineW());
auto doubledash = cmdline.find(L" -- ");
if (doubledash != std::string::npos)
{
cmderOptions.cmderConEmuArgs = cmdline.substr(doubledash + 4);
}
break;
}
else if (cmderOptions.cmderStart == L"")
{
int len = wcslen(szArgList[i]);
@ -633,13 +659,13 @@ cmderOptions GetOption()
}
else
{
MessageBox(NULL, L"Unrecognized parameter.\n\nValid options:\n\n /c [CMDER User Root Path]\n\n /task [ConEmu Task Name]\n\n [/start [Start in Path] | [Start in Path]]\n\n /single\n\n /m\n\nor\n\n /register [USER | ALL]\n\nor\n\n /unregister [USER | ALL]\n", MB_TITLE, MB_OK);
MessageBox(NULL, L"Unrecognized parameter.\n\nValid options:\n\n /c [CMDER User Root Path]\n\n /task [ConEmu Task Name]\n\n [/start [Start in Path] | [Start in Path]]\n\n /single\n\n /m\n\n /x [ConEmu extra arguments]\n\nor\n\n /register [USER | ALL]\n\nor\n\n /unregister [USER | ALL]\n", MB_TITLE, MB_OK);
cmderOptions.error = true;
}
}
else
{
MessageBox(NULL, L"Unrecognized parameter.\n\nValid options:\n\n /c [CMDER User Root Path]\n\n /task [ConEmu Task Name]\n\n [/start [Start in Path] | [Start in Path]]\n\n /single\n\n /m\n\nor\n\n /register [USER | ALL]\n\nor\n\n /unregister [USER | ALL]\n", MB_TITLE, MB_OK);
MessageBox(NULL, L"Unrecognized parameter.\n\nValid options:\n\n /c [CMDER User Root Path]\n\n /task [ConEmu Task Name]\n\n [/start [Start in Path] | [Start in Path]]\n\n /single\n\n /m\n\n /x [ConEmu extra arguments]\n\nor\n\n /register [USER | ALL]\n\nor\n\n /unregister [USER | ALL]\n", MB_TITLE, MB_OK);
cmderOptions.error = true;
}
}
@ -665,11 +691,15 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
{
RegisterShellMenu(cmderOptions.cmderRegScope, SHELL_MENU_REGISTRY_PATH_BACKGROUND, cmderOptions.cmderCfgRoot, cmderOptions.cmderSingle);
RegisterShellMenu(cmderOptions.cmderRegScope, SHELL_MENU_REGISTRY_PATH_LISTITEM, cmderOptions.cmderCfgRoot, cmderOptions.cmderSingle);
RegisterShellMenu(cmderOptions.cmderRegScope, SHELL_MENU_REGISTRY_DRIVE_PATH_BACKGROUND, cmderOptions.cmderCfgRoot, cmderOptions.cmderSingle);
RegisterShellMenu(cmderOptions.cmderRegScope, SHELL_MENU_REGISTRY_DRIVE_PATH_LISTITEM, cmderOptions.cmderCfgRoot, cmderOptions.cmderSingle);
}
else if (cmderOptions.unRegisterApp == true)
{
UnregisterShellMenu(cmderOptions.cmderRegScope, SHELL_MENU_REGISTRY_PATH_BACKGROUND);
UnregisterShellMenu(cmderOptions.cmderRegScope, SHELL_MENU_REGISTRY_PATH_LISTITEM);
UnregisterShellMenu(cmderOptions.cmderRegScope, SHELL_MENU_REGISTRY_DRIVE_PATH_BACKGROUND);
UnregisterShellMenu(cmderOptions.cmderRegScope, SHELL_MENU_REGISTRY_DRIVE_PATH_LISTITEM);
}
else if (cmderOptions.error == true)
{
@ -677,7 +707,7 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
}
else
{
StartCmder(cmderOptions.cmderStart, cmderOptions.cmderSingle, cmderOptions.cmderTask, cmderOptions.cmderCfgRoot, cmderOptions.cmderUserCfg);
StartCmder(cmderOptions.cmderStart, cmderOptions.cmderSingle, cmderOptions.cmderTask, cmderOptions.cmderCfgRoot, cmderOptions.cmderUserCfg, cmderOptions.cmderConEmuArgs);
}
return 0;

53
vendor/bin/alias.cmd vendored
View File

@ -22,10 +22,15 @@ goto parseargument
if /i "%currentarg%" equ "/f" (
set ALIASES=%~2
set _f=%~2
shift
goto :do_shift
) else if /i "%currentarg%" == "/reload" (
goto :p_reload
) else if "%currentarg%" equ "/H" (
goto :p_help
) else if "%currentarg%" equ "/h" (
goto :p_help
) else if "%currentarg%" equ "/?" (
goto :p_help
) else if /i "%currentarg%" equ "/d" (
@ -48,6 +53,7 @@ goto parseargument
set _x=%*
)
)
rem #endregion parseargument
if "%ALIASES%" neq "%CMDER_ROOT%\config\user_aliases.cmd" (
@ -64,24 +70,24 @@ if "%ALIASES%" neq "%CMDER_ROOT%\config\user_aliases.cmd" (
)
:: validate alias
for /f "delims== tokens=1,* usebackq" %%G in (`echo "%_x%"`) do (
for /f "delims== tokens=1,* usebackq" %%G in (`echo "!_x!"`) do (
set alias_name=%%G
set alias_value=%%H
)
:: leading quotes added while validating
set alias_name=%alias_name:~1%
set alias_name=!alias_name:~1!
:: trailing quotes added while validating
set alias_value=%alias_value:~0,-1%
set alias_value=!alias_value:~0,-1!
::remove spaces
set _temp=%alias_name: =%
if not ["%_temp%"] == ["%alias_name%"] (
echo Your alias name can not contain a space
endlocal
exit /b
echo Your alias name can not contain a space
endlocal
exit /b
)
:: replace already defined alias
@ -111,21 +117,32 @@ exit /b
:p_help
echo.Usage:
echo.
echo. alias [options] [alias=full command]
echo. alias [options] [alias=alias command]
echo.
echo.Options:
echo.
echo. /d [alias] Delete an [alias].
echo. /f [macrofile] Path to the [macrofile] you want to store the new alias in.
echo. Default: %cmder_root%\config\user_aliases.cmd
echo. /reload Reload the aliases file. Can be used with /f argument.
echo. Default: %cmder_root%\config\user_aliases.cmd
echo. Note: Options MUST precede the alias definition.
echo.
echo. If alias is called with no parameters, it will display the list of existing aliases.
echo. /d [alias] Delete an [alias].
echo. /f [macrofile] Path to the [macrofile] you want to store the new alias in.
echo. Default: %cmder_root%\config\user_aliases.cmd
echo. /reload Reload the aliases file. Can be used with /f argument.
echo. Default: %cmder_root%\config\user_aliases.cmd
echo.
echo. In the command, you can use the following notations:
echo. $* allows the alias to assume all the parameters of the supplied command.
echo. $1-$9 Allows you to seperate parameter by number, much like %%1 in batch.
echo. $T is the command seperator, allowing you to string several commands together into one alias.
echo. For more information, read DOSKEY/?
echo. If alias is called with no parameters, it will display the list of existing
echo. aliases.
echo.
echo. In the alias command, you can use the following notations:
echo.
echo. ^^^^^^^^%% - %% signs in env vars must be escaped if preserving the variable
echo. in he alias is desired. Variables in aliases surrounded by double
echo. quotes only require '^^%%' vs '^^^^^^^^%%'
echo. $* - allows the alias to assume all the parameters of the supplied
echo. command.
echo. $1-$9 - Allows you to seperate parameter by number, much like %%1 in
echo. batch.
echo. $T - Command seperator, allowing you to string several commands
echo. together into one alias.
echo.
echo. For more information, read DOSKEY /?
exit /b

9
vendor/bin/vscode_init.cmd vendored Normal file
View File

@ -0,0 +1,9 @@
@echo off
IF [%1] == [] (
REM -- manually opened console (Ctrl + Shift + `) --
CALL "%~dp0..\init.bat"
) ELSE (
REM -- task --
CALL cmd %*
exit
)

116
vendor/clink.lua vendored
View File

@ -189,12 +189,15 @@ end
-- @return {false|mercurial branch name}
---
local function get_hg_branch()
for line in io.popen("hg branch 2>nul"):lines() do
local file = io.popen("hg branch 2>nul")
for line in file:lines() do
local m = line:match("(.+)$")
if m then
file:close()
return m
end
end
file:close()
return false
end
@ -204,12 +207,15 @@ end
-- @return {false|svn branch name}
---
local function get_svn_branch(svn_dir)
for line in io.popen("svn info 2>nul"):lines() do
local file = io.popen("svn info 2>nul")
for line in file:lines() do
local m = line:match("^Relative URL:")
if m then
file:close()
return line:sub(line:find("/")+1,line:len())
end
end
file:close()
return false
end
@ -274,6 +280,24 @@ local function get_svn_status()
return true
end
---
-- Get the status of working dir
-- @return {bool}
---
local function get_git_status_setting()
gitStatusSetting = io.popen("git --no-pager config -l 2>nul")
for line in gitStatusSetting:lines() do
if string.match(line, 'cmder.status=false') or string.match(line, 'cmder.cmdstatus=false') then
gitStatusSetting:close()
return false
end
end
gitStatusSetting:close()
return true
end
local function git_prompt_filter()
-- Colors for git status
@ -284,27 +308,30 @@ local function git_prompt_filter()
}
local git_dir = get_git_dir()
if git_dir then
-- if we're inside of git repo then try to detect current branch
local branch = get_git_branch(git_dir)
local color
if branch then
-- Has branch => therefore it is a git folder, now figure out status
local gitStatus = get_git_status()
local gitConflict = get_git_conflict()
color = colors.dirty
if gitStatus then
color = colors.clean
end
if get_git_status_setting() then
if git_dir then
-- if we're inside of git repo then try to detect current branch
local branch = get_git_branch(git_dir)
local color
if branch then
-- Has branch => therefore it is a git folder, now figure out status
local gitStatus = get_git_status()
local gitConflict = get_git_conflict()
if gitConflict then
color = colors.conflict
end
color = colors.dirty
if gitStatus then
color = colors.clean
end
clink.prompt.value = string.gsub(clink.prompt.value, "{git}", color.."("..verbatim(branch)..")")
return false
end
if gitConflict then
color = colors.conflict
end
clink.prompt.value = string.gsub(clink.prompt.value, "{git}", color.."("..verbatim(branch)..")")
return false
end
end
end
-- No git present or not in git file
@ -324,26 +351,26 @@ local function hg_prompt_filter()
dirty = "\x1b[31;1m",
}
-- 'hg id' gives us BOTH the branch name AND an indicator that there
-- are uncommitted changes, in one fast(er) call
local pipe = io.popen("hg id 2>&1")
local pipe = io.popen("hg branch 2>&1")
local output = pipe:read('*all')
local rc = { pipe:close() }
if output ~= nil and
string.sub(output,1,7) ~= "abort: " and -- not an HG working copy
string.sub(output,1,12) ~= "000000000000" and -- empty wc (needs update)
(not string.find(output, "is not recognized")) then -- 'hg' not in path
-- strip the trailing newline from the branch name
local n = #output
while n > 0 and output:find("^%s", n) do n = n - 1 end
local branch = output:sub(1, n)
if branch ~= nil and
string.sub(branch,1,7) ~= "abort: " and -- not an HG working copy
(not string.find(branch, "is not recognized")) then -- 'hg' not in path
local color = colors.clean
-- split elements on space delimiter
local items = {}
for i in string.gmatch(output, "%S+") do
table.insert(items, i)
end
-- if the repo hash ends with '+', the wc has uncommitted changes
if string.sub(items[1], -1, -1) == "+" then color = colors.dirty end
-- substitute the branch in directly -- already WITH parentheses. :)
result = color .. items[2] -- string.sub(items[2], 1, string.len(items[2]) - 1)
local pipe = io.popen("hg status -amrd 2>&1")
local output = pipe:read('*all')
local rc = { pipe:close() }
if output ~= nil and output ~= "" then color = colors.dirty end
result = color .. "(" .. branch .. ")"
end
end
@ -379,7 +406,24 @@ local function svn_prompt_filter()
return false
end
local function tilde_match (text, f, l)
if text == '~' then
clink.add_match(clink.get_env('userprofile'))
clink.matches_are_files()
return true
end
if text:sub(1, 1) == '~' then
clink.add_match(string.gsub(text, "~", clink.get_env('userprofile'), 1))
-- second match prevents adding a space so we can look for more matches
clink.add_match(string.gsub(text, "~", clink.get_env('userprofile'), 1) .. '+')
clink.matches_are_files()
return true
end
end
-- insert the set_prompt at the very beginning so that it runs first
clink.register_match_generator(tilde_match, 1)
clink.prompt.register_filter(set_prompt_filter, 1)
clink.prompt.register_filter(hg_prompt_filter, 50)
clink.prompt.register_filter(git_prompt_filter, 50)

116
vendor/clink_settings.default vendored Normal file
View File

@ -0,0 +1,116 @@
# name: Pressing Ctrl-D exits session
# type: bool
# Ctrl-D exits cmd.exe when it is pressed on an empty line.
ctrld_exits = 1
# name: Toggle if pressing Esc clears line
# type: bool
# Clink clears the current line when Esc is pressed (unless Readline's Vi mode
# is enabled).
esc_clears_line = 1
# name: Match display colour
# type: int
# Colour to use when displaying matches. A value less than 0 will be the
# opposite brightness of the default colour.
match_colour = -1
# name: Executable match style
# type: enum
# 0 = PATH only
# 1 = PATH and CWD
# 2 = PATH, CWD, and directories
# Changes how Clink will match executables when there is no path separator on
# the line. 0 = PATH only, 1 = PATH and CWD, 2 = PATH, CWD, and directories. In
# all cases both executables and directories are matched when there is a path
# separator present. A value of -1 will disable executable matching completely.
exec_match_style = 2
# name: Whitespace prefix matches files
# type: bool
# If the line begins with whitespace then Clink bypasses executable matching and
# will match all files and directories instead.
space_prefix_match_files = 1
# name: Colour of the prompt
# type: int
# Surrounds the prompt in ANSI escape codes to set the prompt's colour. Disabled
# when the value is less than 0.
prompt_colour = -1
# name: Auto-answer terminate prompt
# type: enum
# 0 = Disabled
# 1 = Answer 'Y'
# 2 = Answer 'N'
# Automatically answers cmd.exe's 'Terminate batch job (Y/N)?' prompts. 0 =
# disabled, 1 = answer 'Y', 2 = answer 'N'.
terminate_autoanswer = 0
# name: Lines of history saved to disk
# type: int
# When set to a positive integer this is the number of lines of history that
# will persist when Clink saves the command history to disk. Use 0 for infinite
# lines and <0 to disable history persistence.
history_file_lines = 10000
# name: Skip adding lines prefixed with whitespace
# type: bool
# Ignore lines that begin with whitespace when adding lines in to the history.
history_ignore_space = 0
# name: Controls how duplicate entries are handled
# type: enum
# 0 = Always add
# 1 = Ignore
# 2 = Erase previous
# If a line is a duplicate of an existing history entry Clink will erase the
# duplicate when this is set 2. A value of 1 will not add duplicates to the
# history and a value of 0 will always add lines. Note that history is not
# deduplicated when reading/writing to disk.
history_dupe_mode = 2
# name: Read/write history file each line edited
# type: bool
# When non-zero the history will be read from disk before editing a new line and
# written to disk afterwards.
history_io = 1
# name: Sets how command history expansion is applied
# type: enum
# 0 = Off
# 1 = On
# 2 = Not in single quotes
# 3 = Not in double quote
# 4 = Not in any quotes
# The '!' character in an entered line can be interpreted to introduce words
# from the history. This can be enabled and disable by setting this value to 1
# or 0. Values or 2, 3 or 4 will skip any ! character quoted in single, double,
# or both quotes respectively.
history_expand_mode = 3
# name: Support Windows' Ctrl-Alt substitute for AltGr
# type: bool
# Windows provides Ctrl-Alt as a substitute for AltGr, historically to support
# keyboards with no AltGr key. This may collide with some of Readline's
# bindings.
use_altgr_substitute = 1
# name: Strips CR and LF chars on paste
# type: enum
# 0 = Paste unchanged
# 1 = Strip
# 2 = As space
# Setting this to a value >0 will make Clink strip CR and LF characters from
# text pasted into the current line. Set this to 1 to strip all newline
# characters and 2 to replace them with a space.
strip_crlf_on_paste = 2
# name: Enables basic ANSI escape code support
# type: bool
# When printing the prompt, Clink has basic built-in support for SGR ANSI escape
# codes to control the text colours. This is automatically disabled if a third
# party tool is detected that also provides this facility. It can also be
# disabled by setting this to 0.
ansi_code_support = 1

25
vendor/git-prompt.sh vendored
View File

@ -1,3 +1,14 @@
function getGitStatusSetting() {
gitStatusSetting=$(git --no-pager config -l 2>/dev/null)
if [[ -n ${gitStatusSetting} ]] && [[ ${gitStatusSetting} =~ cmder.status=false ]] || [[ ${gitStatusSetting} =~ cmder.shstatus=false ]]
then
echo false
else
echo true
fi
}
if test -f /etc/profile.d/git-sdk.sh
then
TITLEPREFIX=SDK-${MSYSTEM#MINGW}
@ -7,7 +18,10 @@ fi
if test -f ~/.config/git/git-prompt.sh
then
. ~/.config/git/git-prompt.sh
if [[ $(getGitStatusSetting) == true ]]
then
. ~/.config/git/git-prompt.sh
fi
else
PS1='\[\033]0;$MSYSTEM:${PWD//[^[:ascii:]]/?}\007\]' # set window title
# PS1="$PS1"'\n' # new line
@ -26,9 +40,12 @@ else
if test -f "$COMPLETION_PATH/git-prompt.sh"
then
. "$COMPLETION_PATH/git-completion.bash"
. "$COMPLETION_PATH/git-prompt.sh"
PS1="$PS1"'\[\033[36m\]' # change color to cyan
PS1="$PS1"'`__git_ps1`' # bash function
if [[ $(getGitStatusSetting) == true ]]
then
. "$COMPLETION_PATH/git-prompt.sh"
PS1="$PS1"'\[\033[36m\]' # change color to cyan
PS1="$PS1"'`__git_ps1`' # bash function
fi
fi
fi
PS1="$PS1"'\[\033[0m\]' # change color

198
vendor/init.bat vendored
View File

@ -138,12 +138,14 @@ if "%CMDER_CLINK%" == "1" (
if defined CMDER_USER_CONFIG (
if not exist "%CMDER_USER_CONFIG%\settings" (
echo Generating clink initial settings in "%CMDER_USER_CONFIG%\settings"
copy "%CMDER_ROOT%\vendor\clink_settings.default" "%CMDER_USER_CONFIG%\settings"
echo Additional *.lua files in "%CMDER_USER_CONFIG%" are loaded on startup.\
)
"%CMDER_ROOT%\vendor\clink\clink_x%architecture%.exe" inject --quiet --profile "%CMDER_USER_CONFIG%" --scripts "%CMDER_ROOT%\vendor"
) else (
if not exist "%CMDER_ROOT%\config\settings" (
echo Generating clink initial settings in "%CMDER_ROOT%\config\settings"
copy "%CMDER_ROOT%\vendor\clink_settings.default" "%CMDER_ROOT%\config\settings"
echo Additional *.lua files in "%CMDER_ROOT%\config" are loaded on startup.
)
"%CMDER_ROOT%\vendor\clink\clink_x%architecture%.exe" inject --quiet --profile "%CMDER_ROOT%\config" --scripts "%CMDER_ROOT%\vendor"
@ -163,7 +165,6 @@ if not defined TERM set TERM=cygwin
:: * test if a git is in path and if yes, use that
:: * last, use our vendored git
:: also check that we have a recent enough version of git by examining the version string
setlocal enabledelayedexpansion
if defined GIT_INSTALL_ROOT (
if exist "%GIT_INSTALL_ROOT%\cmd\git.exe" goto :SPECIFIED_GIT
) else if "%fast_init%" == "1" (
@ -182,108 +183,70 @@ if defined GIT_INSTALL_ROOT (
:: check if git is in path...
for /F "delims=" %%F in ('where git.exe 2^>nul') do (
:: get the absolute path to the user provided git binary
pushd %%~dpF
:: check if there's shim - and if yes follow the path
if exist git.shim (
for /F "tokens=2 delims== " %%I in (git.shim) do (
pushd %%~dpI
set "test_dir=!CD!"
popd
)
) else (
set "test_dir=!CD!"
)
popd
:: get the version information for the user provided git binary
%lib_git% read_version USER "!test_dir!"
%lib_git% validate_version USER !GIT_VERSION_USER!
if !errorlevel! geq 0 (
:: compare the user git version against the vendored version
%lib_git% compare_versions USER VENDORED
:: use the user provided git if its version is greater than, or equal to the vendored git
if !errorlevel! geq 0 if exist "!test_dir:~0,-4!\cmd\git.exe" (
set "GIT_INSTALL_ROOT=!test_dir:~0,-4!"
set test_dir=
goto :FOUND_GIT
) else if !errorlevel! geq 0 (
set "GIT_INSTALL_ROOT=!test_dir!"
set test_dir=
goto :FOUND_GIT
) else (
call :verbose_output Found old !GIT_VERSION_USER! in "!test_dir!", but not using...
set test_dir=
)
) else (
:: if the user provided git executable is not found
if !errorlevel! equ -255 (
call :verbose_output No git at "!git_executable!" found.
set test_dir=
)
)
call :is_git_shim "%%~dpF"
call :get_user_git_version
call :compare_git_versions
)
:: our last hope: our own git...
:VENDORED_GIT
if exist "%CMDER_ROOT%\vendor\git-for-windows" (
set "GIT_INSTALL_ROOT=%CMDER_ROOT%\vendor\git-for-windows"
%lib_console% debug_output "Using vendored Git from '!GIT_INSTALL_ROOT!..."
%lib_console% debug_output "Using vendored Git '%GIT_VERSION_VENDORED%'..."
goto :CONFIGURE_GIT
) else (
goto :NO_GIT
)
:SPECIFIED_GIT
%lib_console% debug_output "Using /GIT_INSTALL_ROOT from '%GIT_INSTALL_ROOT%..."
%lib_console% debug_output "Using /GIT_INSTALL_ROOT..."
goto :CONFIGURE_GIT
:FOUND_GIT
%lib_console% debug_output "Using found Git from '%GIT_INSTALL_ROOT%..."
%lib_console% debug_output "Using found Git '%GIT_VERSION_USER%' from '%GIT_INSTALL_ROOT%..."
goto :CONFIGURE_GIT
:CONFIGURE_GIT
%lib_console% debug_output "Using Git from '%GIT_INSTALL_ROOT%..."
:: Add git to the path
if defined GIT_INSTALL_ROOT (
rem add the unix commands at the end to not shadow windows commands like more
if %nix_tools% equ 1 (
%lib_console% debug_output init.bat "Preferring Windows commands"
set "path_position=append"
) else (
%lib_console% debug_output init.bat "Preferring *nix commands"
set "path_position="
)
if exist "!GIT_INSTALL_ROOT!\cmd\git.exe" %lib_path% enhance_path "!GIT_INSTALL_ROOT!\cmd" !path_position!
if exist "!GIT_INSTALL_ROOT!\mingw32" (
%lib_path% enhance_path "!GIT_INSTALL_ROOT!\mingw32\bin" !path_position!
) else if exist "!GIT_INSTALL_ROOT!\mingw64" (
%lib_path% enhance_path "!GIT_INSTALL_ROOT!\mingw64\bin" !path_position!
)
if %nix_tools% geq 1 (
%lib_path% enhance_path "!GIT_INSTALL_ROOT!\usr\bin" !path_position!
)
:: define SVN_SSH so we can use git svn with ssh svn repositories
if not defined SVN_SSH set "SVN_SSH=%GIT_INSTALL_ROOT:\=\\%\\bin\\ssh.exe"
if not defined LANG (
:: Find locale.exe: From the git install root, from the path, using the git installed env, or fallback using the env from the path.
if not defined git_locale if exist "!GIT_INSTALL_ROOT!\usr\bin\locale.exe" set git_locale="!GIT_INSTALL_ROOT!\usr\bin\locale.exe"
if not defined git_locale for /F "delims=" %%F in ('where locale.exe 2^>nul') do (if not defined git_locale set git_locale="%%F")
if not defined git_locale if exist "!GIT_INSTALL_ROOT!\usr\bin\env.exe" set git_locale="!GIT_INSTALL_ROOT!\usr\bin\env.exe" /usr/bin/locale
if not defined git_locale set git_locale=env /usr/bin/locale
for /F "delims=" %%F in ('!git_locale! -uU 2') do (
set "LANG=%%F"
)
)
rem add the unix commands at the end to not shadow windows commands like more
if %nix_tools% equ 1 (
%lib_console% debug_output init.bat "Preferring Windows commands"
set "path_position=append"
) else (
%lib_console% debug_output init.bat "Preferring *nix commands"
set "path_position="
)
if exist "%GIT_INSTALL_ROOT%\cmd\git.exe" %lib_path% enhance_path "%GIT_INSTALL_ROOT%\cmd" %path_position%
if %nix_tools% geq 1 (
if exist "%GIT_INSTALL_ROOT%\mingw32" (
%lib_path% enhance_path "%GIT_INSTALL_ROOT%\mingw32\bin" %path_position%
) else if exist "%GIT_INSTALL_ROOT%\mingw64" (
%lib_path% enhance_path "%GIT_INSTALL_ROOT%\mingw64\bin" %path_position%
)
%lib_path% enhance_path "%GIT_INSTALL_ROOT%\usr\bin" %path_position%
)
:: define SVN_SSH so we can use git svn with ssh svn repositories
if not defined SVN_SSH set "SVN_SSH=%GIT_INSTALL_ROOT:\=\\%\\bin\\ssh.exe"
:: Find locale.exe: From the git install root, from the path, using the git installed env, or fallback using the env from the path.
if not defined git_locale if exist "%GIT_INSTALL_ROOT%\usr\bin\locale.exe" set git_locale="%GIT_INSTALL_ROOT%\usr\bin\locale.exe"
if not defined git_locale for /F "tokens=* delims=" %%F in ('where locale.exe 2^>nul') do ( if not defined git_locale set git_locale="%%F" )
if not defined git_locale if exist "%GIT_INSTALL_ROOT%\usr\bin\env.exe" set git_locale="%GIT_INSTALL_ROOT%\usr\bin\env.exe" /usr/bin/locale
if not defined git_locale for /F "tokens=* delims=" %%F in ('where env.exe 2^>nul') do ( if not defined git_locale set git_locale="%%F" /usr/bin/locale )
if defined git_locale (
%lib_console% debug_output init.bat "Env Var - git_locale=%git_locale%"
if not defined LANG (
for /F "delims=" %%F in ('%git_locale% -uU 2') do (
set "LANG=%%F"
)
)
)
endlocal & set "PATH=%PATH%" & set "LANG=%LANG%" & set "SVN_SSH=%SVN_SSH%" & set "GIT_INSTALL_ROOT=%GIT_INSTALL_ROOT%"
%lib_console% debug_output init.bat "Env Var - GIT_INSTALL_ROOT=%GIT_INSTALL_ROOT%"
%lib_console% debug_output init.bat "Found Git in: '%GIT_INSTALL_ROOT%'"
goto :PATH_ENHANCE
@ -329,22 +292,11 @@ if "%CMDER_ALIASES%" == "1" (
)
REM Make sure we have a self-extracting user_aliases.cmd file
setlocal enabledelayedexpansion
if not exist "%user_aliases%" (
echo Creating initial user_aliases store in "%user_aliases%"...
copy "%CMDER_ROOT%\vendor\user_aliases.cmd.default" "%user_aliases%"
) else (
type "%user_aliases%" | %WINDIR%\System32\findstr /i ";= Add aliases below here" >nul
if "!errorlevel!" == "1" (
echo Creating initial user_aliases store in "%user_aliases%"...
if defined CMDER_USER_CONFIG (
copy "%user_aliases%" "%user_aliases%.old_format"
copy "%CMDER_ROOT%\vendor\user_aliases.cmd.default" "%user_aliases%"
) else (
copy "%user_aliases%" "%user_aliases%.old_format"
copy "%CMDER_ROOT%\vendor\user_aliases.cmd.default" "%user_aliases%"
)
)
%lib_base% update_legacy_aliases
)
:: Update old 'user_aliases' to new self executing 'user_aliases.cmd'
@ -357,7 +309,6 @@ if "%CMDER_ALIASES%" == "1" (
type "%user_aliases%.old_format" >> "%user_aliases%"
del "%user_aliases%.old_format"
)
endlocal
)
:: Add aliases to the environment
@ -367,9 +318,9 @@ call "%user_aliases%"
:: Basically we need to execute this post-install.bat because we are
:: manually extracting the archive rather than executing the 7z sfx
if exist "%GIT_INSTALL_ROOT%\post-install.bat" (
%lib_console% verbose_output "Running Git for Windows one time Post Install...."
echo Running Git for Windows one time Post Install....
pushd "%GIT_INSTALL_ROOT%\"
"%GIT_INSTALL_ROOT%\git-bash.exe" --no-needs-console --hide --no-cd --command=post-install.bat
"%GIT_INSTALL_ROOT%\git-cmd.exe" --no-needs-console --no-cd --command=post-install.bat
popd
)
@ -420,3 +371,56 @@ if %time_init% gtr 0 (
"%cmder_root%\vendor\bin\timer.cmd" %CMDER_INIT_START% %CMDER_INIT_END%
)
exit /b
:is_git_shim
pushd "%~1"
:: check if there's shim - and if yes follow the path
setlocal enabledelayedexpansion
if exist git.shim (
for /F "tokens=2 delims== " %%I in (git.shim) do (
pushd %%~dpI
set "test_dir=!CD!"
popd
)
) else (
set "test_dir=!CD!"
)
endlocal & set "test_dir=%test_dir%"
popd
exit /b
:compare_git_versions
if %errorlevel% geq 0 (
:: compare the user git version against the vendored version
%lib_git% compare_versions USER VENDORED
:: use the user provided git if its version is greater than, or equal to the vendored git
if %errorlevel% geq 0 if exist "%test_dir:~0,-4%\cmd\git.exe" (
set "GIT_INSTALL_ROOT=%test_dir:~0,-4%"
set test_dir=
goto :FOUND_GIT
) else if %errorlevel% geq 0 (
set "GIT_INSTALL_ROOT=%test_dir%"
set test_dir=
goto :FOUND_GIT
) else (
call :verbose_output Found old %GIT_VERSION_USER% in "%test_dir%", but not using...
set test_dir=
)
) else (
:: compare the user git version against the vendored version
:: if the user provided git executable is not found
if %errorlevel% equ -255 (
call :verbose_output No git at "%git_executable%" found.
set test_dir=
)
)
exit /b
:get_user_git_version
:: get the version information for the user provided git binary
%lib_git% read_version USER "%test_dir%"
%lib_git% validate_version USER %GIT_VERSION_USER%
exit /b

View File

@ -65,12 +65,30 @@ exit /b
echo %comspec% | %WINDIR%\System32\find /i "\tcc.exe" > nul && set "CMDER_SHELL=tcc"
echo %comspec% | %WINDIR%\System32\find /i "\tccle" > nul && set "CMDER_SHELL=tccle"
set CMDER_CLINK=1
if "%CMDER_SHELL%" equ "tcc" set CMDER_CLINK=0
if "%CMDER_SHELL%" equ "tccle" set CMDER_CLINK=0
if not defined CMDER_CLINK (
set CMDER_CLINK=1
if "%CMDER_SHELL%" equ "tcc" set CMDER_CLINK=0
if "%CMDER_SHELL%" equ "tccle" set CMDER_CLINK=0
)
set CMDER_ALIASES=1
if "%CMDER_SHELL%" equ "tcc" set CMDER_ALIASES=0
if "%CMDER_SHELL%" equ "tccle" set CMDER_ALIASES=0
if not defined CMDER_ALIASES (
set CMDER_ALIASES=1
if "%CMDER_SHELL%" equ "tcc" set CMDER_ALIASES=0
if "%CMDER_SHELL%" equ "tccle" set CMDER_ALIASES=0
)
exit /b
:update_legacy_aliases
type "%user_aliases%" | %WINDIR%\System32\findstr /i ";= Add aliases below here" >nul
if "%errorlevel%" == "1" (
echo Creating initial user_aliases store in "%user_aliases%"...
if defined CMDER_USER_CONFIG (
copy "%user_aliases%" "%user_aliases%.old_format"
copy "%CMDER_ROOT%\vendor\user_aliases.cmd.default" "%user_aliases%"
) else (
copy "%user_aliases%" "%user_aliases%.old_format"
copy "%CMDER_ROOT%\vendor\user_aliases.cmd.default" "%user_aliases%"
)
)
exit /b

View File

@ -34,7 +34,6 @@ exit /b
::: GIT_VERSION_[GIT SCOPE] <out> Env variable containing Git semantic version string
:::-------------------------------------------------------------------------------
setlocal enabledelayedexpansion
:: clear the variables
set GIT_VERSION_%~1=
@ -49,18 +48,20 @@ exit /b
)
:: get the git version in the provided directory
for /F "tokens=1,2,3 usebackq" %%A in (`"%git_executable%" --version 2^>nul`) do (
"%git_executable%" --version > "%temp%\git_version.txt"
setlocal enabledelayedexpansion
for /F "tokens=1,2,3 usebackq" %%A in (`type "%temp%\git_version.txt" 2^>nul`) do (
if /i "%%A %%B" == "git version" (
set "GIT_VERSION=%%C"
%lib_console% debug_output :read_version "Env Var - GIT_VERSION_%~1=!GIT_VERSION!"
) else (
%lib_console% show_error "git --version" returned an inproper version string!
echo "'git --version' returned an inproper version string!"
pause
exit /b
)
)
endlocal & set "GIT_VERSION_%~1=%GIT_VERSION%" & %lib_console% debug_output :read_version "Env Var - GIT_VERSION_%~1=%GIT_VERSION%"
endlocal & set "GIT_VERSION_%~1=%GIT_VERSION%"
exit /b
:parse_version
@ -88,9 +89,10 @@ exit /b
::: [SCOPE]_BUILD <out> Scoped Build version.
:::-------------------------------------------------------------------------------
setlocal enabledelayedexpansion
:: process a `x.x.x.xxxx.x` formatted string
%lib_console% debug_output :parse_version "ARGV[1]=%~1, ARGV[2]=%~2"
setlocal enabledelayedexpansion
for /F "tokens=1-3* delims=.,-" %%A in ("%2") do (
set "%~1_MAJOR=%%A"
set "%~1_MINOR=%%B"
@ -98,9 +100,17 @@ exit /b
set "%~1_BUILD=%%D"
)
endlocal & set "%~1_MAJOR=!%~1_MAJOR!" & set "%~1_MINOR=!%~1_MINOR!" & set "%~1_PATCH=!%~1_PATCH!" & set "%~1_BUILD=!%~1_BUILD!"
REM endlocal & set "%~1_MAJOR=!%~1_MAJOR!" & set "%~1_MINOR=!%~1_MINOR!" & set "%~1_PATCH=!%~1_PATCH!" & set "%~1_BUILD=!%~1_BUILD!"
if "%~1" == "VENDORED" (
endlocal & set "%~1_MAJOR=%VENDORED_MAJOR%" & set "%~1_MINOR=%VENDORED_MINOR%" & set "%~1_PATCH=%VENDORED_PATCH%" & set "%~1_BUILD=%VENDORED_BUILD%"
) else (
endlocal & set "%~1_MAJOR=%USER_MAJOR%" & set "%~1_MINOR=%USER_MINOR%" & set "%~1_PATCH=%USER_PATCH%" & set "%~1_BUILD=%USER_BUILD%"
)
exit /b
:endlocal_set_git_version
:validate_version
:::===============================================================================
:::validate_version - Validate semantic version string 'x.x.x.x'.
@ -121,10 +131,16 @@ exit /b
:: now parse the version information into the corresponding variables
%lib_console% debug_output :validate_version "ARGV[1]=%~1, ARGV[2]=%~2"
call :parse_version %~1 %~2
:: ... and maybe display it, for debugging purposes.
%lib_console% debug_output :validate_version "Found Git Version for %~1: !%~1_MAJOR!.!%~1_MINOR!.!%~1_PATCH!.!%~1_BUILD!"
REM %lib_console% debug_output :validate_version "Found Git Version for %~1: !%~1_MAJOR!.!%~1_MINOR!.!%~1_PATCH!.!%~1_BUILD!"
if "%~1" == "VENDORED" (
%lib_console% debug_output :validate_version "Found Git Version for %~1: %VENDORED_MAJOR%.%VENDORED_MINOR%.%VENDORED_PATCH%.%VENDORED_BUILD%"
) else (
%lib_console% debug_output :validate_version "Found Git Version for %~1: %USER_MAJOR%.%USER_MINOR%.%USER_PATCH%.%USER_BUILD%"
)
exit /b
:compare_versions
@ -149,20 +165,21 @@ exit /b
:: whichever binary that has the most recent version will be used based on the return code.
%lib_console% debug_output Comparing:
%lib_console% debug_output %~1: !%~1_MAJOR!.!%~1_MINOR!.!%~1_PATCH!.!%~1_BUILD!
%lib_console% debug_output %~2: !%~2_MAJOR!.!%~2_MINOR!.!%~2_PATCH!.!%~2_BUILD!
%lib_console% debug_output %~1: %USER_MAJOR%.%USER_MINOR%.%USER_PATCH%.%USER_BUILD%
%lib_console% debug_output %~2: %VENDORED_MAJOR%.%VENDORED_MINOR%.%VENDORED_PATCH%.%VENDORED_BUILD%
if !%~1_MAJOR! GTR !%~2_MAJOR! (exit /b 1)
if !%~1_MAJOR! LSS !%~2_MAJOR! (exit /b -1)
setlocal enabledelayedexpansion
if !%~1_MAJOR! GTR !%~2_MAJOR! (endlocal & exit /b 1)
if !%~1_MAJOR! LSS !%~2_MAJOR! (endlocal & exit /b -1)
if !%~1_MINOR! GTR !%~2_MINOR! (exit /b 1)
if !%~1_MINOR! LSS !%~2_MINOR! (exit /b -1)
if !%~1_MINOR! GTR !%~2_MINOR! (endlocal & exit /b 1)
if !%~1_MINOR! LSS !%~2_MINOR! (endlocal & exit /b -1)
if !%~1_PATCH! GTR !%~2_PATCH! (exit /b 1)
if !%~1_PATCH! LSS !%~2_PATCH! (exit /b -1)
if !%~1_PATCH! GTR !%~2_PATCH! (endlocal & exit /b 1)
if !%~1_PATCH! LSS !%~2_PATCH! (endlocal & exit /b -1)
if !%~1_BUILD! GTR !%~2_BUILD! (exit /b 1)
if !%~1_BUILD! LSS !%~2_BUILD! (exit /b -1)
if !%~1_BUILD! GTR !%~2_BUILD! (endlocal & exit /b 1)
if !%~1_BUILD! LSS !%~2_BUILD! (endlocal & exit /b -1)
:: looks like we have the same versions.
exit /b 0
endlocal & exit /b 0

View File

@ -38,7 +38,6 @@ exit /b
::: path <out> Sets the path env variable if required.
:::-------------------------------------------------------------------------------
setlocal enabledelayedexpansion
if "%~1" neq "" (
set "add_path=%~1"
) else (
@ -65,24 +64,31 @@ exit /b
set "find_query=%add_path%"
set "find_query=%find_query:\=\\%"
set "find_query=%find_query: =\ %"
set OLD_PATH=%PATH%
if "%CMDER_CONFIGURED%" == "1" (
%lib_console% debug_output :enhance_path "Env Var - find_query=%find_query%"
echo "%path%"|%WINDIR%\System32\findstr >nul /I /R ";%find_query%\"$"
if "!ERRORLEVEL!" == "0" set found=1
setlocal enabledelayedexpansion
if "%found%" == "0" (
echo "%path%"|%WINDIR%\System32\findstr >nul /I /R /C:";%find_query%;"
call :set_found
)
%lib_console% debug_output :enhance_path "Env Var 1 - found=!found!"
%lib_console% debug_output :enhance_path "Env Var INSIDE PATH %find_query% - found=%found%"
if "!found!" == "0" (
if "%CMDER_CONFIGURED%" == "1" (
echo "%path%"|%WINDIR%\System32\findstr >nul /i /r ";%find_query%;"
if "!ERRORLEVEL!" == "0" set found=1
)
%lib_console% debug_output :enhance_path "Env Var 2 - found=!found!"
if /i "%position%" == "append" (
if "!found!" == "0" (
echo "%path%"|%WINDIR%\System32\findstr >nul /I /R /C:";%find_query%\"$"
call :set_found
)
%lib_console% debug_output :enhance_path "Env Var END PATH %find_query% - found=!found!"
) else (
if "!found!" == "0" (
echo "%path%"|%WINDIR%\System32\findstr >nul /I /R /C:"^\"%find_query%;"
call :set_found
)
%lib_console% debug_output :enhance_path "Env Var BEGIN PATH %find_query% - found=!found!"
)
endlocal & set found=%found%
if "%found%" == "0" (
%lib_console% debug_output :enhance_path "BEFORE Env Var - PATH=!path!"
if /i "%position%" == "append" (
%lib_console% debug_output :enhance_path "Appending '%add_path%'"
set "PATH=%PATH%;%add_path%"
@ -91,11 +97,23 @@ exit /b
set "PATH=%add_path%;%PATH%"
)
%lib_console% debug_output :enhance_path "AFTER Env Var - PATH=!path!"
set found=1
)
:end_enhance_path
endlocal & set "PATH=%PATH:;;=;%"
set "PATH=%PATH:;;=;%"
if NOT "%OLD_PATH%" == "%PATH%" (
%lib_console% debug_output :enhance_path "END Env Var - PATH=%path%"
%lib_console% debug_output :enhance_path "Env Var %find_query% - found=%found%"
)
set "position="
exit /b
:set_found
if "%ERRORLEVEL%" == "0" (
set found=1
)
exit /b
:enhance_path_recursive
@ -125,7 +143,6 @@ exit /b
:::.
::: path <out> Sets the path env variable if required.
:::-------------------------------------------------------------------------------
setlocal enabledelayedexpansion
if "%~1" neq "" (
set "add_path=%~1"
) else (
@ -147,7 +164,11 @@ exit /b
if "%fast_init%" == "1" (
call :enhance_path "%add_path%" %position%
goto :end_enhance_path_recursive
)
set "PATH=%PATH:;;=;%"
if "%fast_init%" == "1" (
exit /b
)
if "%depth%" == "" set depth=0
@ -156,19 +177,26 @@ exit /b
%lib_console% debug_output :enhance_path_recursive "Env Var - position=%position%"
%lib_console% debug_output :enhance_path_recursive "Env Var - max_depth=%max_depth%"
if %max_depth% gtr !depth! (
if %max_depth% gtr %depth% (
%lib_console% debug_output :enhance_path_recursive "Adding parent directory - '%add_path%'"
call :enhance_path "%add_path%" %position%
set /a "depth=!depth!+1"
for /d %%i in ("%add_path%\*") do (
%lib_console% debug_output :enhance_path_recursive "Env Var BEFORE - depth=!depth!"
%lib_console% debug_output :enhance_path_recursive "Found Subdirectory - '%%~fi'"
call :enhance_path_recursive "%%~fi" %max_depth% %position%
%lib_console% debug_output :enhance_path_recursive "Env Var AFTER- depth=!depth!"
)
call :set_depth
call :loop_depth
)
:end_enhance_path_recursive
endlocal & set "PATH=%PATH%"
set "PATH=%PATH%"
exit /b
: set_depth
set /a "depth=%depth%+1"
exit /b
:loop_depth
for /d %%i in ("%add_path%\*") do (
%lib_console% debug_output :enhance_path_recursive "Env Var BEFORE - depth=%depth%"
%lib_console% debug_output :enhance_path_recursive "Found Subdirectory - '%%~fi'"
call :enhance_path_recursive "%%~fi" %max_depth% %position%
%lib_console% debug_output :enhance_path_recursive "Env Var AFTER- depth=%depth%"
)
exit /b

134
vendor/profile.ps1 vendored
View File

@ -25,101 +25,53 @@ if (! $ENV:CMDER_ROOT ) {
# Remove trailing '\'
$ENV:CMDER_ROOT = (($ENV:CMDER_ROOT).trimend("\"))
# do not load bundled psget if a module installer is already available
# Do not load bundled psget if a module installer is already available
# -> recent PowerShell versions include PowerShellGet out of the box
$moduleInstallerAvailable = [bool](Get-Command -Name 'Install-Module' -ErrorAction SilentlyContinue | Out-Null)
$moduleInstallerAvailable = [bool](Get-Command -Name 'Install-Module' -ErrorAction SilentlyContinue)
# Add Cmder modules directory to the autoload path.
$CmderModulePath = Join-path $PSScriptRoot "psmodules/"
$CmderFunctions = Join-Path $CmderModulePath "Cmder.ps1"
. $CmderFunctions
if(-not $moduleInstallerAvailable -and -not $env:PSModulePath.Contains($CmderModulePath) ){
$env:PSModulePath = $env:PSModulePath.Insert(0, "$CmderModulePath;")
}
try {
Get-command -Name "vim" -ErrorAction Stop >$null
} catch {
# # You could do this but it may be a little drastic and introduce a lot of
# # unix tool overlap with powershel unix like aliases
# $env:Path += $(";" + $env:CMDER_ROOT + "\vendor\git-for-windows\usr\bin")
# set-alias -name "vi" -value "vim"
# # I think the below is safer.
new-alias -name "vim" -value $($ENV:CMDER_ROOT + "\vendor\git-for-windows\usr\bin\vim.exe")
new-alias -name "vi" -value vim
}
try {
# Check if git is on PATH, i.e. Git already installed on system
Get-command -Name "git" -ErrorAction Stop >$null
} catch {
$env:Path += $(";" + $env:CMDER_ROOT + "\vendor\git-for-windows\cmd")
# for bash.exe, which in the cmd version is found as <GIT>\usr\bin\bash.exe
$env:Path += $(";" + $env:CMDER_ROOT + "\vendor\git-for-windows\bin")
if (test-path "$env:CMDER_ROOT\vendor\git-for-windows") {
Configure-Git "$env:CMDER_ROOT\vendor\git-for-windows"
}
}
$gitLoaded = $false
function Import-Git($Loaded){
if($Loaded) { return }
$GitModule = Get-Module -Name Posh-Git -ListAvailable
if($GitModule | select version | where version -le ([version]"0.6.1.20160330")){
Import-Module Posh-Git > $null
}
if(-not ($GitModule) ) {
Write-Warning "Missing git support, install posh-git with 'Install-Module posh-git' and restart cmder."
}
# Make sure we only run once by alawys returning true
return $true
}
function checkGit($Path) {
if (Test-Path -Path (Join-Path $Path '.git') ) {
$gitLoaded = Import-Git $gitLoaded
Write-VcsStatus
return
}
$SplitPath = split-path $path
if ($SplitPath) {
checkGit($SplitPath)
}
if ( Get-command -Name "vim" -ErrorAction silentlycontinue) {
new-alias -name "vi" -value vim
}
if (Get-Module PSReadline -ErrorAction "SilentlyContinue") {
Set-PSReadlineOption -ExtraPromptLineCount 1
}
# Enhance Path
$env:Path = "$Env:CMDER_ROOT\bin;$Env:CMDER_ROOT\vendor\bin;$env:Path;$Env:CMDER_ROOT"
#
# Prompt Section
# Users should modify their user_profile.ps1 as it will be safe from updates.
#
# Pre assign the hooks so the first run of cmder gets a working prompt.
# Pre assign default prompt hooks so the first run of cmder gets a working prompt.
$env:gitLoaded = $false
[ScriptBlock]$PrePrompt = {}
[ScriptBlock]$PostPrompt = {}
[ScriptBlock]$CmderPrompt = {
$Host.UI.RawUI.ForegroundColor = "White"
Write-Host -NoNewline "$([char]0x200B)"
Microsoft.PowerShell.Utility\Write-Host $pwd.ProviderPath -NoNewLine -ForegroundColor Green
checkGit($pwd.ProviderPath)
if (get-command git -erroraction silentlycontinue) {
checkGit($pwd.ProviderPath)
}
Microsoft.PowerShell.Utility\Write-Host "`nλ " -NoNewLine -ForegroundColor "DarkGray"
}
<#
This scriptblock runs every time the prompt is returned.
Explicitly use functions from MS namespace to protect from being overridden in the user session.
Custom prompt functions are loaded in as constants to get the same behaviour
#>
[ScriptBlock]$Prompt = {
$realLASTEXITCODE = $LASTEXITCODE
$host.UI.RawUI.WindowTitle = Microsoft.PowerShell.Management\Split-Path $pwd.ProviderPath -Leaf
PrePrompt | Microsoft.PowerShell.Utility\Write-Host -NoNewline
CmderPrompt
Microsoft.PowerShell.Utility\Write-Host "`nλ " -NoNewLine -ForegroundColor "DarkGray"
PostPrompt | Microsoft.PowerShell.Utility\Write-Host -NoNewline
$global:LASTEXITCODE = $realLASTEXITCODE
return " "
}
# Enhance Path
$env:Path = "$Env:CMDER_ROOT\bin;$Env:CMDER_ROOT\vendor\bin;$env:Path;$Env:CMDER_ROOT"
# Drop *.ps1 files into "$ENV:CMDER_ROOT\config\profile.d"
# to source them at startup.
@ -154,7 +106,7 @@ if ($ENV:CMDER_USER_CONFIG -ne "" -and (test-path "$ENV:CMDER_USER_CONFIG\profil
}
popd
}
# Renaming to "config\user_profile.ps1" to "user_profile.ps1" for consistency.
if (test-path "$env:CMDER_ROOT\config\user-profile.ps1") {
rename-item "$env:CMDER_ROOT\config\user-profile.ps1" user_profile.ps1
@ -185,11 +137,43 @@ if (! (Test-Path $CmderUserProfilePath) ) {
Copy-Item "$env:CMDER_ROOT\vendor\user_profile.ps1.default" -Destination $CmderUserProfilePath
}
# Once Created these code blocks cannot be overwritten
Set-Item -Path function:\PrePrompt -Value $PrePrompt -Options Constant
Set-Item -Path function:\CmderPrompt -Value $CmderPrompt -Options Constant
Set-Item -Path function:\PostPrompt -Value $PostPrompt -Options Constant
#
# Prompt Section
# Users should modify their user_profile.ps1 as it will be safe from updates.
#
# Functions can be made constant only at creation time
# ReadOnly at least requires `-force` to be overwritten
Set-Item -Path function:\prompt -Value $Prompt -Options ReadOnly
# Only set the prompt if it is currently set to the default
# This allows users to configure the prompt in their user_profile.ps1 or config\profile.d\*.ps1
if ( $(get-command prompt).Definition -match 'PS \$\(\$executionContext.SessionState.Path.CurrentLocation\)\$\(' -and `
$(get-command prompt).Definition -match '\(\$nestedPromptLevel \+ 1\)\) ";') {
<#
This scriptblock runs every time the prompt is returned.
Explicitly use functions from MS namespace to protect from being overridden in the user session.
Custom prompt functions are loaded in as constants to get the same behaviour
#>
[ScriptBlock]$Prompt = {
$realLASTEXITCODE = $LASTEXITCODE
$host.UI.RawUI.WindowTitle = Microsoft.PowerShell.Management\Split-Path $pwd.ProviderPath -Leaf
PrePrompt | Microsoft.PowerShell.Utility\Write-Host -NoNewline
CmderPrompt
PostPrompt | Microsoft.PowerShell.Utility\Write-Host -NoNewline
$global:LASTEXITCODE = $realLASTEXITCODE
return " "
}
# Once Created these code blocks cannot be overwritten
# if (-not $(get-command PrePrompt).Options -match 'Constant') {Set-Item -Path function:\PrePrompt -Value $PrePrompt -Options Constant}
# if (-not $(get-command CmderPrompt).Options -match 'Constant') {Set-Item -Path function:\CmderPrompt -Value $CmderPrompt -Options Constant}
# if (-not $(get-command PostPrompt).Options -match 'Constant') {Set-Item -Path function:\PostPrompt -Value $PostPrompt -Options Constant}
Set-Item -Path function:\PrePrompt -Value $PrePrompt -Options Constant
Set-Item -Path function:\CmderPrompt -Value $CmderPrompt -Options Constant
Set-Item -Path function:\PostPrompt -Value $PostPrompt -Options Constant
# Functions can be made constant only at creation time
# ReadOnly at least requires `-force` to be overwritten
# if (!$(get-command Prompt).Options -match 'ReadOnly') {Set-Item -Path function:\prompt -Value $Prompt -Options ReadOnly}
Set-Item -Path function:\prompt -Value $Prompt -Options ReadOnly
}

59
vendor/psmodules/Cmder.ps1 vendored Normal file
View File

@ -0,0 +1,59 @@
function Configure-Git($GIT_INSTALL_ROOT){
$env:Path += $(";" + $GIT_INSTALL_ROOT + "\cmd")
# Add "$GIT_INSTALL_ROOT\usr\bin" to the path if exists and not done already
$GIT_INSTALL_ROOT_ESC=$GIT_INSTALL_ROOT.replace('\','\\')
if ((test-path "$GIT_INSTALL_ROOT\usr\bin") -and -not ($env:path -match "$GIT_INSTALL_ROOT_ESC\\usr\\bin")) {
$env:path = "$env:path;$GIT_INSTALL_ROOT\usr\bin"
}
# Add "$GIT_INSTALL_ROOT\mingw[32|64]\bin" to the path if exists and not done already
if ((test-path "$GIT_INSTALL_ROOT\mingw32\bin") -and -not ($env:path -match "$GIT_INSTALL_ROOT_ESC\\mingw32\\bin")) {
$env:path = "$env:path;$GIT_INSTALL_ROOT\mingw32\bin"
} elseif ((test-path "$GIT_INSTALL_ROOT\mingw64\bin") -and -not ($env:path -match "$GIT_INSTALL_ROOT_ESC\\mingw64\\bin")) {
$env:path = "$env:path;$GIT_INSTALL_ROOT\mingw64\bin"
}
}
function Import-Git(){
$GitModule = Get-Module -Name Posh-Git -ListAvailable
if($GitModule | select version | where version -le ([version]"0.6.1.20160330")){
Import-Module Posh-Git > $null
}
if(-not ($GitModule) ) {
Write-Warning "Missing git support, install posh-git with 'Install-Module posh-git' and restart cmder."
}
# Make sure we only run once by alawys returning true
return $true
}
function checkGit($Path) {
if (Test-Path -Path (Join-Path $Path '.git') ) {
if($env:gitLoaded -eq 'false') {
$env:gitLoaded = Import-Git
}
if (getGitStatusSetting -eq $true) {
Write-VcsStatus
}
return
}
$SplitPath = split-path $path
if ($SplitPath) {
checkGit($SplitPath)
}
}
function getGitStatusSetting() {
$gitStatus = (git --no-pager config -l) | out-string
ForEach ($line in $($gitStatus -split "`r`n")) {
if ($line -match 'cmder.status=false' -or $line -match 'cmder.psstatus=false') {
return $false
}
}
return $true
}

12
vendor/sources.json vendored
View File

@ -1,8 +1,8 @@
[
{
"name": "git-for-windows",
"version": "v2.19.0.windows.1",
"url": "https://github.com/git-for-windows/git/releases/download/v2.19.0.windows.1/PortableGit-2.19.0-64-bit.7z.exe"
"version": "v2.24.1.windows.2",
"url": "https://github.com/git-for-windows/git/releases/download/v2.24.1.windows.2/PortableGit-2.24.1.2-64-bit.7z.exe"
},
{
"name": "clink",
@ -11,12 +11,12 @@
},
{
"name": "conemu-maximus5",
"version": "180626",
"url": "https://github.com/Maximus5/ConEmu/releases/download/v18.06.26/ConEmuPack.180626.7z"
"version": "191012",
"url": "https://github.com/Maximus5/ConEmu/releases/download/v19.10.12/ConEmuPack.191012.7z"
},
{
"name": "clink-completions",
"version": "0.3.3",
"url": "https://github.com/vladimir-kotikov/clink-completions/archive/0.3.3.zip"
"version": "0.3.5",
"url": "https://github.com/vladimir-kotikov/clink-completions/archive/0.3.5.zip"
}
]

View File

@ -9,7 +9,7 @@ gl=git log --oneline --all --graph --decorate $*
ls=ls --show-control-chars -F --color $*
pwd=cd
clear=cls
history=cat "%CMDER_ROOT%\config\.history"
history=cat -n "%CMDER_ROOT%\config\.history"
unalias=alias /d $1
vi=vim $*
cmderr=cd /d "%CMDER_ROOT%"

View File

@ -23,3 +23,19 @@
## <Continue to add your own>
# # Delete default powershell aliases that conflict with bash commands
# if (get-command git) {
# del -force alias:cat
# del -force alias:clear
# del -force alias:cp
# del -force alias:diff
# del -force alias:echo
# del -force alias:kill
# del -force alias:ls
# del -force alias:mv
# del -force alias:ps
# del -force alias:pwd
# del -force alias:rm
# del -force alias:sleep
# del -force alias:tee
# }