CASM  1.1.0
A Clusters Approach to Statistical Mechanics
CASM::Completer::ArgHandler Class Reference

#include <Handlers.hh>

Detailed Description

Handle the value type names of po::option_description. This class determines what the keywords mean, and translates them into the ARG_TYPE enum as appropriate.

If you want bash completion for your boost program options, never specify option_description::value_name manually (e.g. raw string), always request the string through this class.

When the Engine class isn't returning strings corresponding to options or suboptions that bash should complete, then the user is in the process of writing out an argument. By printing out keywords, the bash completer script can know what kind of arguments are needed for the casm command:

VOID: Don't complete anything PATH: Suggest path completions to a file or directory COMMAND: Suggest executables within the environment PATH SCELNAME: Run through the PrimClex and suggest the enumerated supercell names QUERY: Suggest the available query options OPERATORS: Suggest the available operators casm knows how to use (TODO: This one might be tricky to implement)

Definition at line 39 of file Handlers.hh.

Public Types

enum  ARG_TYPE {
  VOID , PATH , COMMAND , SCELNAME ,
  QUERY , OPERATOR , CONFIGNAME , COORDTYPE ,
  DBTYPE , ENUMMETHOD , CONFIGTYPE , CALCTYPE ,
  BSET , CLEX , REF , ECI ,
  PROPERTY , DOF , INFOMETHOD
}
 

Static Public Member Functions

static ARG_TYPE determine_type (const po::option_description &boost_option)
 
static std::string path ()
 Get value_type string for path completion. More...
 
static std::string command ()
 Get value_type string for command completion (i.e. stuff in your $PATH) More...
 
static std::string supercell ()
 Get value_type string for supercell completion. More...
 
static std::string query ()
 Get value_type string for query completion. More...
 
static std::string operation ()
 Get value_type string for operation completion. More...
 
static std::string configname ()
 Get value_type string for configuration completion. More...
 
static std::string coordtype ()
 Get value_type string for coordinate mode completion. More...
 
static std::string dbtype ()
 Get value_type string for dbtype mode completion. More...
 
static std::string enummethod ()
 Get value_type string for enummethod mode completion. More...
 
static std::string configtype ()
 Get value_type string for configtype mode completion. More...
 
static std::string calctype ()
 Get value_type string for calctype mode completion. More...
 
static std::string bset ()
 Get value_type string for bset mode completion. More...
 
static std::string clex ()
 Get value_type string for clex mode completion. More...
 
static std::string ref ()
 Get value_type string for ref mode completion. More...
 
static std::string eci ()
 Get value_type string for eci mode completion. More...
 
static std::string property ()
 Get value_type string for property mode completion. More...
 
static std::string dof ()
 Get value_type string for property mode completion. More...
 
static std::string infomethod ()
 Get value_type string for infomethod mode completion. More...
 
static void void_to_bash (std::vector< std::string > &arguments)
 
static void path_to_bash (std::vector< std::string > &arguments)
 Fill the output strings with bash completion appropriate values for PATH. More...
 
static void command_to_bash (std::vector< std::string > &arguments)
 
static void scelname_to_bash (std::vector< std::string > &arguments)
 
static void configname_to_bash (std::vector< std::string > &arguments)
 
static void query_to_bash (std::vector< std::string > &arguments)
 Fill the output strings with bash completion appropriate values for QUERY. More...
 
static void operator_to_bash (std::vector< std::string > &arguments)
 
static void dbtype_to_bash (std::vector< std::string > &arguments)
 Fill the output strings with bash completion appropriate values for DBTYPE. More...
 
static void enummethod_to_bash (std::vector< std::string > &arguments)
 
static void configtype_to_bash (std::vector< std::string > &arguments)
 
static void calctype_to_bash (std::vector< std::string > &arguments)
 
static void bset_to_bash (std::vector< std::string > &arguments)
 Fill the output strings with bash completion appropriate values for BSET. More...
 
static void clex_to_bash (std::vector< std::string > &arguments)
 Fill the output strings with bash completion appropriate values for CLEX. More...
 
static void ref_to_bash (std::vector< std::string > &arguments)
 Fill the output strings with bash completion appropriate values for REF. More...
 
static void eci_to_bash (std::vector< std::string > &arguments)
 Fill the output strings with bash completion appropriate values for ECI. More...
 
static void property_to_bash (std::vector< std::string > &arguments)
 
static void dof_to_bash (std::vector< std::string > &arguments)
 Fill the output strings with bash completion appropriate values for DOF. More...
 
static void infomethod_to_bash (std::vector< std::string > &arguments)
 

Static Private Attributes

static const std::vector< std::pair< std::string, ARG_TYPE > > m_argument_table
 

Member Enumeration Documentation

◆ ARG_TYPE

Enumerator
VOID 
PATH 
COMMAND 
SCELNAME 
QUERY 
OPERATOR 
CONFIGNAME 
COORDTYPE 
DBTYPE 
ENUMMETHOD 
CONFIGTYPE 
CALCTYPE 
BSET 
CLEX 
REF 
ECI 
PROPERTY 
DOF 
INFOMETHOD 

Definition at line 41 of file Handlers.hh.

Member Function Documentation

◆ bset()

std::string CASM::Completer::ArgHandler::bset ( )
static

Get value_type string for bset mode completion.

Definition at line 78 of file Handlers.cc.

◆ bset_to_bash()

void CASM::Completer::ArgHandler::bset_to_bash ( std::vector< std::string > &  arguments)
static

Fill the output strings with bash completion appropriate values for BSET.

Definition at line 193 of file Handlers.cc.

◆ calctype()

std::string CASM::Completer::ArgHandler::calctype ( )
static

Get value_type string for calctype mode completion.

Definition at line 76 of file Handlers.cc.

◆ calctype_to_bash()

void CASM::Completer::ArgHandler::calctype_to_bash ( std::vector< std::string > &  arguments)
static

Fill the output strings with bash completion appropriate values for CALCTYPE

Definition at line 182 of file Handlers.cc.

◆ clex()

std::string CASM::Completer::ArgHandler::clex ( )
static

Get value_type string for clex mode completion.

Definition at line 80 of file Handlers.cc.

◆ clex_to_bash()

void CASM::Completer::ArgHandler::clex_to_bash ( std::vector< std::string > &  arguments)
static

Fill the output strings with bash completion appropriate values for CLEX.

Definition at line 204 of file Handlers.cc.

◆ command()

std::string CASM::Completer::ArgHandler::command ( )
static

Get value_type string for command completion (i.e. stuff in your $PATH)

Definition at line 58 of file Handlers.cc.

◆ command_to_bash()

void CASM::Completer::ArgHandler::command_to_bash ( std::vector< std::string > &  arguments)
static

Fill the output strings with bash completion appropriate values for COMMAND

Definition at line 99 of file Handlers.cc.

◆ configname()

std::string CASM::Completer::ArgHandler::configname ( )
static

Get value_type string for configuration completion.

Definition at line 66 of file Handlers.cc.

◆ configname_to_bash()

void CASM::Completer::ArgHandler::configname_to_bash ( std::vector< std::string > &  arguments)
static

Fill the output strings with bash completion appropriate values for CONFIGNAME

Definition at line 116 of file Handlers.cc.

◆ configtype()

std::string CASM::Completer::ArgHandler::configtype ( )
static

Get value_type string for configtype mode completion.

Definition at line 74 of file Handlers.cc.

◆ configtype_to_bash()

void CASM::Completer::ArgHandler::configtype_to_bash ( std::vector< std::string > &  arguments)
static

Fill the output strings with bash completion appropriate values for CONFIGTYPE

Definition at line 175 of file Handlers.cc.

◆ coordtype()

std::string CASM::Completer::ArgHandler::coordtype ( )
static

Get value_type string for coordinate mode completion.

Definition at line 68 of file Handlers.cc.

◆ dbtype()

std::string CASM::Completer::ArgHandler::dbtype ( )
static

Get value_type string for dbtype mode completion.

Definition at line 70 of file Handlers.cc.

◆ dbtype_to_bash()

void CASM::Completer::ArgHandler::dbtype_to_bash ( std::vector< std::string > &  arguments)
static

Fill the output strings with bash completion appropriate values for DBTYPE.

Definition at line 160 of file Handlers.cc.

◆ determine_type()

ARG_TYPE CASM::Completer::ArgHandler::determine_type ( const po::option_description &  boost_option)
static

Translate the stored boost value_name into an ARG_TYPE for the completer engine

Definition at line 28 of file Handlers.cc.

◆ dof()

std::string CASM::Completer::ArgHandler::dof ( )
static

Get value_type string for property mode completion.

Definition at line 88 of file Handlers.cc.

◆ dof_to_bash()

void CASM::Completer::ArgHandler::dof_to_bash ( std::vector< std::string > &  arguments)
static

Fill the output strings with bash completion appropriate values for DOF.

Definition at line 250 of file Handlers.cc.

◆ eci()

std::string CASM::Completer::ArgHandler::eci ( )
static

Get value_type string for eci mode completion.

Definition at line 84 of file Handlers.cc.

◆ eci_to_bash()

void CASM::Completer::ArgHandler::eci_to_bash ( std::vector< std::string > &  arguments)
static

Fill the output strings with bash completion appropriate values for ECI.

Definition at line 226 of file Handlers.cc.

◆ enummethod()

std::string CASM::Completer::ArgHandler::enummethod ( )
static

Get value_type string for enummethod mode completion.

Definition at line 72 of file Handlers.cc.

◆ enummethod_to_bash()

void CASM::Completer::ArgHandler::enummethod_to_bash ( std::vector< std::string > &  arguments)
static

Fill the output strings with bash completion appropriate values for ENUMMETHOD

Definition at line 167 of file Handlers.cc.

◆ infomethod()

std::string CASM::Completer::ArgHandler::infomethod ( )
static

Get value_type string for infomethod mode completion.

Definition at line 90 of file Handlers.cc.

◆ infomethod_to_bash()

void CASM::Completer::ArgHandler::infomethod_to_bash ( std::vector< std::string > &  arguments)
static

Fill the output strings with bash completion appropriate values for INFOMETHOD

Definition at line 261 of file Handlers.cc.

◆ operation()

std::string CASM::Completer::ArgHandler::operation ( )
static

Get value_type string for operation completion.

Definition at line 64 of file Handlers.cc.

◆ operator_to_bash()

void CASM::Completer::ArgHandler::operator_to_bash ( std::vector< std::string > &  arguments)
static

Fill the output strings with bash completion appropriate values for OPERATOR

Definition at line 128 of file Handlers.cc.

◆ path()

std::string CASM::Completer::ArgHandler::path ( )
static

Get value_type string for path completion.

Definition at line 56 of file Handlers.cc.

◆ path_to_bash()

void CASM::Completer::ArgHandler::path_to_bash ( std::vector< std::string > &  arguments)
static

Fill the output strings with bash completion appropriate values for PATH.

Definition at line 94 of file Handlers.cc.

◆ property()

std::string CASM::Completer::ArgHandler::property ( )
static

Get value_type string for property mode completion.

Definition at line 86 of file Handlers.cc.

◆ property_to_bash()

void CASM::Completer::ArgHandler::property_to_bash ( std::vector< std::string > &  arguments)
static

Fill the output strings with bash completion appropriate values for PROPERTY

Definition at line 239 of file Handlers.cc.

◆ query()

std::string CASM::Completer::ArgHandler::query ( )
static

Get value_type string for query completion.

Definition at line 62 of file Handlers.cc.

◆ query_to_bash()

void CASM::Completer::ArgHandler::query_to_bash ( std::vector< std::string > &  arguments)
static

Fill the output strings with bash completion appropriate values for QUERY.

Definition at line 140 of file Handlers.cc.

◆ ref()

std::string CASM::Completer::ArgHandler::ref ( )
static

Get value_type string for ref mode completion.

Definition at line 82 of file Handlers.cc.

◆ ref_to_bash()

void CASM::Completer::ArgHandler::ref_to_bash ( std::vector< std::string > &  arguments)
static

Fill the output strings with bash completion appropriate values for REF.

Definition at line 215 of file Handlers.cc.

◆ scelname_to_bash()

void CASM::Completer::ArgHandler::scelname_to_bash ( std::vector< std::string > &  arguments)
static

Fill the output strings with bash completion appropriate values for SCELNAME

Definition at line 104 of file Handlers.cc.

◆ supercell()

std::string CASM::Completer::ArgHandler::supercell ( )
static

Get value_type string for supercell completion.

Definition at line 60 of file Handlers.cc.

◆ void_to_bash()

void CASM::Completer::ArgHandler::void_to_bash ( std::vector< std::string > &  arguments)
static

Fill the output strings with bash completion appropriate values for VOID (i.e. do nothing)

Definition at line 92 of file Handlers.cc.

Member Data Documentation

◆ m_argument_table

const std::vector< std::pair< std::string, ARG_TYPE > > CASM::Completer::ArgHandler::m_argument_table
staticprivate

List of pairs relating the value type name of po::option_description to its corresponding argument type

This construction right here determines what the value_name of the boost options should be named. It is through these strings that bash completion can know which types of completions to suggest.

Definition at line 188 of file Handlers.hh.


The documentation for this class was generated from the following files: