Struct ghastoolkit::codeql::cli::CodeQL

source ·
pub struct CodeQL { /* private fields */ }
Expand description

CodeQL CLI Wrapper to make it easier to run CodeQL commands

Implementations§

source§

impl CodeQL

source

pub fn new() -> Self

Create a new CodeQL instance

source

pub fn init() -> CodeQLBuilder

Initialize a new CodeQL Builder instance

source

pub fn find_codeql() -> Option<PathBuf>

Find CodeQL CLI on the system

source

pub fn run(&self, args: Vec<&str>) -> Result<String, GHASError>

Run a CodeQL command

source

pub fn database<'a>( &'a self, db: &'a CodeQLDatabase ) -> CodeQLDatabaseHandler<'_, '_>

Pass a CodeQLDatabase to the CodeQL CLI to return a CodeQLDatabaseHandler. This handler can be used to run queries and other operations on the database.

source

pub fn version(&self) -> Result<String, GHASError>

Get the version of the CodeQL CLI

source

pub fn get_languages(&self) -> Result<Vec<CodeQLLanguage>, GHASError>

Get the programming languages supported by the CodeQL CLI. This function will return the primary languages supported by the CodeQL and exclude any secondary languages (checkout get_secondary_languages()).

§Example
use ghastoolkit::CodeQL;

let codeql = CodeQL::default();

let languages = codeql.get_languages()
    .expect("Failed to get languages");

for language in languages {
   println!("Language: {}", language.pretty());
   // Do something with the language
}
source

pub fn get_secondary_languages(&self) -> Result<Vec<CodeQLLanguage>, GHASError>

Get the secondary languages supported by the CodeQL CLI

source

pub fn get_all_languages(&self) -> Result<Vec<CodeQLLanguage>, GHASError>

Get all languages supported by the CodeQL CLI

Trait Implementations§

source§

impl Clone for CodeQL

source§

fn clone(&self) -> CodeQL

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for CodeQL

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for CodeQL

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl Display for CodeQL

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for CodeQL

§

impl RefUnwindSafe for CodeQL

§

impl Send for CodeQL

§

impl Sync for CodeQL

§

impl Unpin for CodeQL

§

impl UnwindSafe for CodeQL

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

impl<T> PolicyExt for T
where T: ?Sized,

source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T> ToStringFallible for T
where T: Display,

source§

fn try_to_string(&self) -> Result<String, TryReserveError>

ToString::to_string, but without panic on OOM.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more