-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
128 additions
and
5 deletions.
There are no files selected for viewing
9 changes: 9 additions & 0 deletions
9
docs/document/Csharp Design Patterns/docs/Behavioural/Mediator.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Mediator | ||
|
||
Facilitates communications between components. | ||
|
||
## Motivation | ||
|
||
- Communications between clients on any presence or absence. Like a chatroom or online games. | ||
|
||
So mediator usually as a central facility to handle communications from different clients, clients are not required to know each other. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# Alias | ||
|
||
## Set an Alias | ||
|
||
```ps1 | ||
New-Alias <alias> <cmd_name> | ||
``` | ||
|
||
> [!note] | ||
> `New-Alias` throws when the alias already exist while `Set-Alias` will overrides it. | ||
## Override an Alias | ||
|
||
```ps1 | ||
Set-Alias <alias> <cmd_name> | ||
``` | ||
|
||
## Checkout Alias | ||
|
||
- Check out by alias | ||
|
||
```ps1 | ||
Get-Alias <alias> | ||
``` | ||
|
||
Or use `Get-Command` | ||
|
||
```ps1 | ||
Get-Command <alias> | ||
``` | ||
|
||
- Check out by command name | ||
|
||
```ps1 | ||
Get-Alias -Definition <cmd_name> | ||
``` | ||
|
||
## Builtin Aliases | ||
|
||
Powershell ships with some builtin aliases, checkout by this command: | ||
|
||
```ps1 | ||
Get-Alias | Where-Object { $_.Options -match 'ReadOnly|Constant' } | ||
``` | ||
|
||
> [!note] | ||
> Do not use custom aliases for public repository. | ||
## Differ from Bash | ||
|
||
Alias in powershell is only a name alias for a command, it can never take any predetermined parameters or flags like in bash. | ||
|
||
```sh | ||
alias gl='git log' # fine | ||
``` | ||
|
||
```ps1 | ||
New-Alias gl 'git log' # not allowed! # [!code error] | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Overview | ||
|
||
- Dynamic typing | ||
- Case insensitive |
Empty file.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# | ||
|
||
## Terminology | ||
|
||
Powershell has its own terminologies besides other shells like bash. | ||
It's a shell integrated with .NET, it's not a independent platform. | ||
|
||
- `cmdlet`: builtin utils inside powershell, implemented using other languages like `C#`. | ||
- `function`: a command implemented using powershell language itself. | ||
- `application`: external executables. |