<s> import click <EOL> from shpkpr . cli import arguments <EOL> from shpkpr . cli import options <EOL> from shpkpr . cli . entrypoint import CONTEXT_SETTINGS <EOL> from shpkpr . cli . logger import pass_logger <EOL> @ click . group ( '<STR_LIT>' , short_help = '<STR_LIT>' , context_settings = CONTEXT_SETTINGS ) <EOL> @ pass_logger <EOL> def cli ( logger ) : <EOL> """<STR_LIT>""" <EOL> @ cli . command ( '<STR_LIT:list>' , short_help = '<STR_LIT>' , context_settings = CONTEXT_SETTINGS ) <EOL> @ options . application_id <EOL> @ options . marathon_client <EOL> @ pass_logger <EOL> def list ( logger , marathon_client , application_id ) : <EOL> """<STR_LIT>""" <EOL> application = marathon_client . get_application ( application_id ) <EOL> for k , v in sorted ( application [ '<STR_LIT>' ] . items ( ) ) : <EOL> logger . log ( "<STR_LIT>" , k , v ) <EOL> @ cli . command ( '<STR_LIT>' , short_help = '<STR_LIT>' , context_settings = CONTEXT_SETTINGS ) <EOL> @ arguments . env_pairs <EOL> @ options . application_id <EOL> @ options . force <EOL> @ options . marathon_client <EOL> @ pass_logger <EOL> def set ( logger , marathon_client , force , application_id , env_pairs ) : <EOL> """<STR_LIT>""" <EOL> existing_application = marathon_client . get_application ( application_id ) <EOL> application = { '<STR_LIT:id>' : application_id , '<STR_LIT>' : existing_application [ '<STR_LIT>' ] } <EOL> for k , v in env_pairs . items ( ) : <EOL> application [ '<STR_LIT>' ] [ k ] = v <EOL> marathon_client . deploy ( application , force = force ) . wait ( ) <EOL> @ cli . command ( '<STR_LIT>' , short_help = '<STR_LIT>' , context_settings = CONTEXT_SETTINGS ) <EOL> @ arguments . env_keys <EOL> @ options . application_id <EOL> @ options . force <EOL> @ options . marathon_client <EOL> @ pass_logger <EOL> def unset ( logger , marathon_client , force , application_id , env_keys ) : <EOL> """<STR_LIT>""" <EOL> existing_application = marathon_client . get_application ( application_id ) <EOL> application = { '<STR_LIT:id>' : application_id , '<STR_LIT>' : existing_application [ '<STR_LIT>' ] } <EOL> for key in env_keys : <EOL> try : <EOL> del application [ '<STR_LIT>' ] [ key ] <EOL> except KeyError : <EOL> pass <EOL> marathon_client . deploy ( application , force = force ) . wait ( ) </s>
