Skip to content

Commit dd9173c

Browse files
authored
Merge pull request #80 from rulasg/search-repo
feat: add Search-Repo function and update documentation
2 parents f3982ab + 24855f3 commit dd9173c

4 files changed

Lines changed: 142 additions & 0 deletions

File tree

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Semantic Commit Messages
2+
3+
See how a minor change to your commit message style can make you a better programmer.
4+
5+
Format: `<type>(<scope>): <subject>`
6+
7+
`<scope>` is optional
8+
9+
## Example
10+
11+
```
12+
feat: add hat wobble
13+
^--^ ^------------^
14+
| |
15+
| +-> Summary in present tense.
16+
|
17+
+-------> Type: chore, docs, feat, fix, refactor, style, or test.
18+
```
19+
20+
More Examples:
21+
22+
- `feat`: (new feature for the user, not a new feature for build script)
23+
- `fix`: (bug fix for the user, not a fix to a build script)
24+
- `docs`: (changes to the documentation)
25+
- `style`: (formatting, missing semi colons, etc; no production code change)
26+
- `refactor`: (refactoring production code, eg. renaming a variable)
27+
- `test`: (adding missing tests, refactoring tests; no production code change)
28+
- `chore`: (updating grunt tasks etc; no production code change)
29+
30+
References:
31+
32+
- https://www.conventionalcommits.org/
33+
- https://seesparkbox.com/foundry/semantic_commit_messages
34+
- http://karma-runner.github.io/1.0/dev/git-commit-msg.html

.github/copilot-instructions.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Copilot Instructions
2+
3+
## Powershell Modules Code Instructions
4+
5+
### PowerShell Functions Instructions
6+
7+
Every powershell function will contain the `CmdletBinding` attribute and the `parm`iven if there are no parameters.
8+
If the function is on the public folder of the module, we will add the Èxport-ModuleFunction` statement in the same line as the closing `}` of the function
9+
10+
Sample of function will be:
11+
12+
```powershell
13+
14+
function Get-UserName{
15+
[CmdletBinding()]
16+
param()
17+
18+
#Logic of the function
19+
} Export-ModuleFunction -FunctionName 'Get-UserName'
20+
```
21+
22+
### PowerShell Test Instructions
23+
24+
Every public function on the Test module will have the following format
25+
26+
- Name will start with `Test_` will follow the name of the function that we are testing with no '-'. It will follow the intention of the test splited with a '_'
27+
- Every time we create a new function with no body we will add the `Assert-NotImplemented` statement at the end
28+
- We will add the 3 sections as with comments `Arrange`, `Act` and `Assert` to make the test more readable.
29+
- Sample of a test function to test `Get-UserName` function will be `Test_GetUserName_UserNotFound`
30+
31+
Full sample will be as follows
32+
33+
```powershell
34+
function Test_GetUserName_UserNotFound{
35+
36+
# Arrange
37+
38+
# Act
39+
40+
# Assert
41+
42+
Assert-NotImplemented
43+
}
44+
```
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Pull Request Code Instructions
2+
3+
## PR TITLE
4+
5+
Follow this guidelines to construct the title of your pull request.
6+
7+
Format: `<type>(<scope>): <subject>`
8+
9+
`<scope>` is optional
10+
11+
## Example
12+
13+
```
14+
feat: add hat wobble
15+
^--^ ^------------^
16+
| |
17+
| +-> Summary in present tense.
18+
|
19+
+-------> Type: chore, docs, feat, fix, refactor, style, or test.
20+
```
21+
22+
More Examples:
23+
24+
- `feat`: (new feature for the user, not a new feature for build script)
25+
- `fix`: (bug fix for the user, not a fix to a build script)
26+
- `docs`: (changes to the documentation)
27+
- `style`: (formatting, missing semi colons, etc; no production code change)
28+
- `refactor`: (refactoring production code, eg. renaming a variable)
29+
- `test`: (adding missing tests, refactoring tests; no production code change)
30+
- `chore`: (updating grunt tasks etc; no production code change)
31+
32+
References:
33+
34+
- https://www.conventionalcommits.org/
35+
- https://seesparkbox.com/foundry/semantic_commit_messages
36+
- http://karma-runner.github.io/1.0/dev/git-commit-msg.html
37+
38+
## Pull Reques description
39+
40+
- Add a summery of the intention of the PR. Use the title and the messages of the commits to create a summary.
41+
- Add a list with all the commit messages in the PR.
42+
43+
44+

public/repo-search.ps1

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,23 @@ function Find-RepoByName{
4646

4747
return $ret
4848
} Export-ModuleMember -Function Find-RepoByName
49+
50+
function Search-Repo{
51+
[CmdletBinding()]
52+
param(
53+
[Parameter(Mandatory,Position=0)][string]$SearchString
54+
)
55+
56+
$attributes = 'name,url'
57+
58+
$command = 'gh search repos {searchstring} --json {attributes}'
59+
60+
$command = $command -replace "{searchstring}", "$($SearchString)"
61+
$command = $command -replace "{attributes}", "$($attributes)"
62+
63+
$command | Write-Verbose
64+
65+
$ret = Invoke-GhExpression -Command $command
66+
67+
return $ret
68+
} Export-ModuleMember -Function Search-Repo

0 commit comments

Comments
 (0)