Skip to content

Commit

Permalink
update readme with help message
Browse files Browse the repository at this point in the history
  • Loading branch information
Baruch Odem committed Jun 25, 2023
1 parent ae5afa2 commit 76b1df3
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 8 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ on:
push:
branches: [master]

permissions:
contents: write

jobs:
test:
name: Test
Expand All @@ -27,6 +30,29 @@ jobs:
- name: Unit Tests
run: go test ./...

- name: update README
run: |
help_message=$(go run .)
echo '```' > output.txt
echo "$help_message" >> output.txt
echo '```' >> output.txt
sed -i '/<!-- command-line:start -->/,/<!-- command-line:end -->/{
/<!-- command-line:start -->/{
p
r output.txt
}
/<!-- command-line:end -->/!d
}' README.md
- name: commit and push
id: git-check
continue-on-error: true
run: |
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
git add README.md
git diff-index --quiet HEAD || git commit -m "docs: update help message in README.md"
git push
- name: Gets release info
id: semantic_release_info
if: github.event_name == 'workflow_dispatch'
Expand Down
45 changes: 39 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ During the software development lifecycle (SDLC), developers ofen communicate an
- Git
- Paligo
- Local directory / files

## Getting 2ms

```
Expand All @@ -35,12 +35,45 @@ docker run -v path/to/my/repo:/repo checkmarx/2ms git /repo

## Getting started

### Command line arguments (wip, see [#20](https://github.com/Checkmarx/2ms/discussions/20))
<!-- command-line:start -->

bla bla bla

```
2ms Secrets Detection: A tool to detect secrets in public websites and communication services.
Usage:
2ms [command]
Commands
confluence Scan Confluence server
discord Scan Discord server
filesystem Scan local folder
git Scan Git repository
paligo Scan Paligo instance
slack Scan Slack team
Additional Commands:
completion Generate the autocompletion script for the specified shell
help Help about any command
Flags:
--config string YAML config file path
-h, --help help for 2ms
--log-level string log level (trace, debug, info, warn, error, fatal) (default "info")
--regex stringArray custom regexes to apply to the scan, must be valid Go regex
--report-path strings path to generate report files. The output format will be determined by the file extension (.json, .yaml, .sarif)
--stdout-format string stdout output format, available formats are: json, yaml, sarif (default "yaml")
--tags strings select rules to be applied (default [all])
-v, --version version for 2ms
Use "2ms [command] --help" for more information about a command.
bla bla bla
```

bla bla bla

- `--confluence` The URL of the Confluence instance to scan.
- `--confluence-spaces` A comma-separated list of Confluence spaces to scan.
- `--confluence-username` confluence username or email
- `--confluence-token` confluence token
<!-- command-line:end -->

---

Expand Down
3 changes: 2 additions & 1 deletion cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ func Execute() {
vConfig.AutomaticEnv()

cobra.OnInitialize(initialize)
rootCmd.PersistentFlags().StringVar(&configFilePath, configFileFlag, "", "YAML config file path")
rootCmd.PersistentFlags().StringVar(&configFilePath, configFileFlag, "", "config file path")
cobra.CheckErr(rootCmd.MarkPersistentFlagFilename(configFileFlag, "yaml", "yml", "json"))
rootCmd.PersistentFlags().StringSliceVar(&tagsVar, tagsFlagName, []string{"all"}, "select rules to be applied")
rootCmd.PersistentFlags().StringVar(&logLevelVar, logLevelFlagName, "info", "log level (trace, debug, info, warn, error, fatal)")
rootCmd.PersistentFlags().StringSliceVar(&reportPathVar, reportPathFlagName, []string{}, "path to generate report files. The output format will be determined by the file extension (.json, .yaml, .sarif)")
Expand Down
2 changes: 1 addition & 1 deletion lib/flags_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -711,7 +711,7 @@ subcommand:
}
testString := cmd.PersistentFlags().String("test-string", "", "Test string flag")
testInt := cmd.PersistentFlags().Int("test-int", 0, "Test int flag")
assert.NoError(t, cmd.MarkFlagRequired("test-string"))
assert.NoError(t, cmd.MarkPersistentFlagRequired("test-string"))
cmd.PersistentFlags().String(configFlagName, "", "Config file name")

var subcommandBool bool
Expand Down

0 comments on commit 76b1df3

Please sign in to comment.