-
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.
Signed-off-by: Caroline Russell <[email protected]>
- Loading branch information
1 parent
c9c6a5a
commit e9f46dc
Showing
12 changed files
with
271 additions
and
39 deletions.
There are no files selected for viewing
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
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
""" | ||
A cli, classes and functions for converting an atom slice to a different format | ||
""" | ||
__version__ = '0.5.5' | ||
__version__ = '0.6.0' |
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
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,64 @@ | ||
# pylint: disable=R0801 | ||
"""Query Reachables Command for the atom-tools CLI.""" | ||
import logging | ||
|
||
from cleo.helpers import option | ||
|
||
from atom_tools.cli.commands.command import Command | ||
from atom_tools.lib.slices import AtomSlice | ||
from atom_tools.lib.utils import check_reachable | ||
|
||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
class CheckReachableCommand(Command): | ||
""" | ||
This command handles the conversion of an atom slice to a specified | ||
destination format. | ||
Attributes: | ||
name (str): The name of the command. | ||
description (str): The description of the command. | ||
options (list): The list of options for the command. | ||
help (str): The help message for the command. | ||
Methods: | ||
handle: Executes the command and performs the conversion. | ||
""" | ||
|
||
name = 'check-reachable' | ||
description = ('Find out if there are hits for a given package:version or file:linenumber in ' | ||
'an atom slice.') | ||
options = [ | ||
option( | ||
'input-slice', | ||
'i', | ||
'Slice file', | ||
flag=False, | ||
value_required=True, | ||
), | ||
option( | ||
'pkg', | ||
'p', | ||
'Package to search for in the format of <package_name>:<version>', | ||
flag=False, | ||
), | ||
option( | ||
'location', | ||
'l', | ||
'Filename with line number to search for in the format of <filename>:<linenumber>', | ||
flag=False, | ||
), | ||
] | ||
help = """Checks for reachable flows for a pkg:version or file:linenumber in an atom slice.""" | ||
|
||
loggers = ['atom_tools.lib.filtering', 'atom_tools.lib.regex_utils', 'atom_tools.lib.slices', | ||
'atom_tools.lib.utils'] | ||
|
||
def handle(self): | ||
""" | ||
Executes the query command and performs the search. | ||
""" | ||
atom_slice = AtomSlice(self.option('input-slice')) | ||
print(check_reachable(atom_slice.content, self.option('pkg'), self.option('location'))) |
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
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
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
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
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
Oops, something went wrong.