Skip to content

Commit

Permalink
fix(docstring for readthedocs)
Browse files Browse the repository at this point in the history
  • Loading branch information
matthieu Bouamama committed Dec 19, 2020
1 parent b94f632 commit 551ea92
Show file tree
Hide file tree
Showing 11 changed files with 141 additions and 56 deletions.
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,24 @@
# Changelog
All notable changes to this project will be documented in this file.

## [1.1.0] - 19-12-2020
### Added
- Output format: json, csv, txt
- output format option
- output-file option
- readthedocs
- category list
- pull_request templates
- new table display
### Changed
- CI/CD
- CODE_OF_CONDUCT
- codecov conf
- pytest
- numpy docstring
- rework templates
- api doc

## [1.0.0] - 08-12-2020
### Added
- search
Expand Down
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
author = "matthieu Bouamama"

# The full version, including alpha/beta/rc tags
release = "1.0.0"
release = "1.1.0"


# -- General configuration ---------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ This cli can search a project,list all projects by category, you can filter your
Getting help
--------

If the Documentation doesn’t answer your question, you can discuss rawsec-cli or get help using it on `Rawsec-cli's repository discussion <https://github.com/mBouamama/rawsec_cli/discussions.>`_
If the Documentation doesn’t answer your question, you can discuss rawsec-cli or get help using it on `Rawsec-cli's repository discussion <https://github.com/mBouamama/rawsec_cli/discussions>`_.
Bug reports are gladly accepted at the `GitHub issue tracker <https://github.com/mBouamama/rawsec_cli/issues>`_. GitHub also hosts the `code repository <https://github.com/mBouamama/rawsec_cli>`_.


Expand Down
4 changes: 2 additions & 2 deletions rawsec_cli/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# autogenerated
__version__ = "1.0.0"
__commit__ = "7d57b97e7f1751e6374a743d1bb170ba5f7d89ac"
__version__ = "1.1.0"
__commit__ = "b94f6324237224c7d18f81c96479ffbaadab3dc4"
2 changes: 2 additions & 0 deletions rawsec_cli/cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,14 @@ def cli(ctx, version):
This cli can search a project,list all projects by category, you can filter your research with option --help for more information.
Full documentation: https://rawsec-cli.readthedocs.io/
\f
Parameters
----------
ctx: click Context
click Context.
version: bool
version flag.
Returns
-------
None
Expand Down
5 changes: 4 additions & 1 deletion rawsec_cli/cli/command/list_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,11 @@ def list_command():
List projects by category (tools, resources, ctf, os).
Full documentation: https://rawsec-cli.readthedocs.io/
\f
Returns
-------
None
List of project
List of project.
"""
pass

Expand Down Expand Up @@ -101,6 +102,7 @@ def tools(
List all tools inventoried on rawsec, you can add category.
Full documentation: https://rawsec-cli.readthedocs.io/
\f
Parameters
----------
ctx: Context
Expand Down Expand Up @@ -207,6 +209,7 @@ def resources(ctx, category, paid, free, output, output_file):
List all resources inventoried on rawsec, you can add category.
Full documentation: https://rawsec-cli.readthedocs.io/
\f
Parameters
----------
ctx: Context
Expand Down
3 changes: 2 additions & 1 deletion rawsec_cli/cli/command/search_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,11 @@ def search(
Search in name and description.
Full documentation: https://rawsec-cli.readthedocs.io/
\f
Parameters
----------
ctx: Context
Click context
Click context.
project: str, optional
Keyword.
lang: str, optional
Expand Down
3 changes: 2 additions & 1 deletion rawsec_cli/filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ def filter_projects(
) -> List[Dict]:
"""
Filter method.
Parameters
----------
projects: List
Expand All @@ -34,7 +35,7 @@ def filter_projects(
Returns
-------
List[Dict]
project filter
project filter.
"""
if lang is not None and lang != "":
projects = [
Expand Down
38 changes: 27 additions & 11 deletions rawsec_cli/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,18 @@

def print_output(projects: List, output="table", file=None, wanted_keys=None):
"""
Generate Output
Generate Output.
Parameters
----------
projects: List
projects: List[Dict]
project list.
output: str
output format.
file: str or None
file name, file extension will erased output variable.
wanted_keys: List, optional
only keys you want.
Returns
----------
Expand All @@ -39,11 +44,14 @@ def print_output(projects: List, output="table", file=None, wanted_keys=None):

def json_output(projects: list, file=None):
"""
Generate json output format
Generate json output format.
Parameters
----------
projects: list of dict
projects: List[Dict]
project list.
file: str, optional
file name.
"""
if file is not None:
with open(file, "w") as f:
Expand All @@ -54,12 +62,16 @@ def json_output(projects: list, file=None):

def csv_output(projects: list, wanted_keys: list, file=None):
"""
Generate csv output format
Generate csv output format.
Parameters
----------
projects: list of dict
wanted_keys: list of str
projects: List[Dict]
projects list.
wanted_keys: List[str]
only keys you want.
file: str, optional
file name.
"""
if file is not None:
fileobj = open(file, "w")
Expand All @@ -73,12 +85,16 @@ def csv_output(projects: list, wanted_keys: list, file=None):

def table_output(projects: list, wanted_keys: list, file=None):
"""
Generate txt output format, use columnar for generate table
Generate txt output format, use columnar for generate table.
Parameters
----------
projects: list of dict
wanted_keys: list of str
file: str or None, optional
projects: List[Dict]
projects list.
wanted_keys: List[str]
only keys you want.
file: str, optional
file name.
"""
table_projects = list()
for project in projects:
Expand Down
40 changes: 25 additions & 15 deletions rawsec_cli/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,18 @@
def search_project_tools(json: Dict, project: str) -> List[Dict]:
"""
Search project in tool's category.
Parameters
----------
json: Dict
rawsec projects json
rawsec projects json.
project: str
project name or description
project name or description.
Returns
-------
List[Dict]
list of rawsec projects
list of rawsec projects.
"""
list_projects = list()
for tool in get_all_tools(json):
Expand All @@ -35,16 +37,18 @@ def search_project_tools(json: Dict, project: str) -> List[Dict]:
def search_project_resources(json: Dict, project: str) -> List[Dict]:
"""
Search project in resources's category.
Parameters
----------
json: Dict
rawsec projects json
rawsec projects json.
project: str
project name or description
project name or description.
Returns
-------
List[Dict]
list of rawsec projects
list of rawsec projects.
"""
list_projects = list()
for resource in get_all_resources(json):
Expand All @@ -61,16 +65,18 @@ def search_project_resources(json: Dict, project: str) -> List[Dict]:
def search_project_ctf(json: Dict, project: str) -> List[Dict]:
"""
Search project in ctf's category.
Parameters
----------
json: Dict
rawsec projects json
rawsec projects json.
project: str
project name or description
project name or description.
Returns
-------
List[Dict]
list of rawsec projects
list of rawsec projects.
"""
list_projects = list()
for ctf in get_all_ctf(json):
Expand All @@ -85,16 +91,18 @@ def search_project_ctf(json: Dict, project: str) -> List[Dict]:
def search_project_operating(json: Dict, project: str) -> List[Dict]:
"""
Search project in os's category.
Parameters
----------
json: Dict
rawsec projects json
rawsec projects json.
project: str
project name or description
project name or description.
Returns
-------
List[Dict]
list of rawsec projects
list of rawsec projects.
"""
list_projects = list()
for operating in get_all_operating(json):
Expand All @@ -106,16 +114,18 @@ def search_project_operating(json: Dict, project: str) -> List[Dict]:
def search_project(json: Dict, project: str) -> List[Dict]:
"""
Search project in all category.
Parameters
----------
json: Dict
rawsec projects json
rawsec projects json.
project: str
project name or description
project name or description.
Returns
-------
List[Dict]
list of rawsec projects
list of rawsec projects.
"""
return (
search_project_tools(json, project)
Expand Down
Loading

0 comments on commit 551ea92

Please sign in to comment.