Module bp_cli :: Class CLI
[hide private]
[frames] | no frames]

Class CLI

source code

object --+
         |
        CLI

BitPim Command Line Interface implementation

Instance Methods [hide private]
 
__init__(self, arg, file_in, file_out, file_err, config_filename=None, comm_port=None, phone_model=None)
Constructor
source code
 
_parse_args(self, args, force_phonefs=False)
Parse the args for a list of input and out args
source code
 
run(self, cmdline=None)
Execute the specified command if specified, or the one currently stored
source code
 
log(self, logstr) source code
 
logdata(self, logstr, logdata, dataclass=None, datatype=None) source code
 
progress(self, pos, maxcnt, desc)
Update the progress meter
source code
 
ls(self, args)
Do a directory listing
source code
 
ll(self, args)
Do a long dir listing command
source code
 
_cpfilefromphone(self, filename, destdir) source code
 
_cpdirfromphone(self, dirname, destdir, wildcard) source code
 
_cpfromphone(self, args) source code
 
_cpfiletophone(self, name, destdir, phonefs=False, force=False) source code
 
_cpdirtophone(self, dirname, destdir, phonefs=False) source code
 
_cptophone(self, args) source code
 
cp(self, args)
Transfer files between the phone filesystem and local filesystem
source code
 
mkdir(self, args)
Create one or more dirs on the phone FS.
source code
 
cli(self, _)
Run a primitive interactive CLI sesssion.
source code
 
cd(self, args)
Change the current working dir on the phone FS.
source code
 
cdu(self, args)
Change to current working dir on the phone up one level (parent).
source code
 
pwd(self, _)
Print the current working dir(cwd/pwd) on the phone FS.
source code
 
cwd(self, _)
Print the current working dir(cwd/pwd) on the phone FS.
source code
 
rm(self, args)
delete one or more files on the phone FS.
source code
 
rmdir(self, args)
Delete one or more phone FS directories.
source code

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Class Variables [hide private]
  _phone_prefix = 'phone:'
  _phone_prefix_len = 6
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, arg, file_in, file_out, file_err, config_filename=None, comm_port=None, phone_model=None)
(Constructor)

source code 

Constructor

Parameters:
  • arg - command string including the command and its argument
  • file_in - input stream file object
  • file_out - output stream file object
  • file_err - error strean file object
  • config_filename - use this config file instead of the default
  • comm_port - string name of the comm port to use (default to config file)
  • phone_model - string phone model to use (default to config file)
Overrides: object.__init__

_parse_args(self, args, force_phonefs=False)

source code 

Parse the args for a list of input and out args

Parameters:
  • args - input agrs
Returns:
a dict that has 2 keys: 'source' and 'dest'. 'source' has a list of files and/or directories. 'dest' is either a file or dir.

run(self, cmdline=None)

source code 

Execute the specified command if specified, or the one currently stored

Parameters:
  • cmdline - string command line
Returns:
(T, None) if the command completed successfully, (F, error code) otherwise

ls(self, args)

source code 

Do a directory listing

Parameters:
  • args - string directory names
Returns:
(True, None) if successful, (False, error code) otherwise

ll(self, args)

source code 

Do a long dir listing command

Parameters:
  • args - string directory names
Returns:
(True, None) if successful, (False, error code) otherwise

cp(self, args)

source code 

Transfer files between the phone filesystem and local filesystem

Parameters:
  • args - string dir names
Returns:
(True, None) if successful, (False, error code) otherwise

mkdir(self, args)

source code 

Create one or more dirs on the phone FS.

Parameters:
  • args - string dir names
Returns:
(True, None) if successful, (False, error code) otherwise

cli(self, _)

source code 

Run a primitive interactive CLI sesssion.

Returns:
always (True, None)

cd(self, args)

source code 

Change the current working dir on the phone FS.

Parameters:
  • args - dir name(s), only args[0] matters.
Returns:
(True, None) if successful, (False, error code) otherwise

cdu(self, args)

source code 

Change to current working dir on the phone up one level (parent).

Parameters:
  • _ - don't care
Returns:
(True, None) if successful, (False, error code) otherwise

pwd(self, _)

source code 

Print the current working dir(cwd/pwd) on the phone FS.

Returns:
(True, None)

cwd(self, _)

source code 

Print the current working dir(cwd/pwd) on the phone FS.

Returns:
(True, None)

rm(self, args)

source code 

delete one or more files on the phone FS. This command does not delete local files.

Parameters:
  • args - file names
Returns:
(True, None) if successful, (False, error code) otherwise.

rmdir(self, args)

source code 

Delete one or more phone FS directories. This command does not delete local directories.

Parameters:
  • args - dir names.
Returns:
(True, None) if successful, (False, error code) otherwise.