ビルトインエイリアス

このページでは、xonshの組み込みコマンドとエイリアスについて説明します。

cd

ディレクトリを変更します。ディレクトリが指定されていない場合(つまり、引数がない場合)、現在のユーザのホームディレクトリに変更されます。

pushd

ディレクトリスタックの一番上にディレクトリを追加するか、スタックを回転させて、スタックの新しいトップを現在の作業ディレクトリにします。

usage: pushd [-h] [-n] [-q] [dir]

positional arguments:
  dir

optional arguments:
  -h, --help  show this help message and exit
  -n          Suppresses the normal change of directory when adding
              directories to the stack, so that only the stack is manipulated.
  -q          Do not call dirs, regardless of $PUSHD_SILENT

popd

ディレクトリスタックからエントリを削除します。

usage: pushd [-h] [-n] [-q] [dir]

positional arguments:
  dir

optional arguments:
  -h, --help  show this help message and exit
  -n          Suppresses the normal change of directory when adding
              directories to the stack, so that only the stack is manipulated.
  -q          Do not call dirs, regardless of $PUSHD_SILENT

dirs

現在保存されているディレクトリのリストを表示します。ディレクトリスタックをクリアするためにも使用できます。

usage: dirs [-h] [-c] [-p] [-v] [-l] [N]

positional arguments:
  N

optional arguments:
  -h, --help  show this help message and exit
  -c          Clears the directory stack by deleting all of the entries.
  -p          Print the directory stack with one entry per line.
  -v          Print the directory stack with one entry per line, prefixing
              each entry with its index in the stack.
  -l          Produces a longer listing; the default listing format uses a
              tilde to denote the home directory.

jobs

現在のすべてのジョブのリストを表示します。

fg

現在アクティブなジョブをフォアグラウンドにするか、単一の番号が引数として指定されている場合は、そのジョブをフォアグラウンドに持ってきてください。

bg

バックグラウンドで現在アクティブなジョブの実行を再開するか、単一の番号が引数として指定されている場合は、そのジョブをバックグラウンドで再開します。

EOFexitおよびquit

コマンドEOFexitおよびquitすべての別名がある同じアクションは、安全な方法でxonshままにします。入力Crtl-dは、入力EOFしてEnterを押すのと同じです。

execxexec


source

現在のコンテキストで提供されたファイルの内容を実行します。これはもちろん、xonshとPythonファイルでのみ動作します。

source-bash

sourceコマンドと同じですが、Bashファイルです。これは引数が自動的に設定されるsource-foreignエイリアスの周りの薄いラッパーです。shellbash

source-foreign

sourceコマンドと同じですが、外国語(非xonsh)言語のファイルです。それは環境と任意のエイリアスをピックアップします。

usage: source-foreign [-h] [-i INTERACTIVE] [-l LOGIN] [--envcmd ENVCMD]
                      [--aliascmd ALIASCMD] [--extra-args EXTRA_ARGS]
                      [-s SAFE] [-p PREVCMD] [--postcmd POSTCMD]
                      [--funcscmd FUNCSCMD] [--sourcer SOURCER]
                      [--use-tmpfile USE_TMPFILE]
                      [--seterrprevcmd SETERRPREVCMD]
                      [--seterrpostcmd SETERRPOSTCMD] [--overwrite-aliases]
                      [--suppress-skip-message] [--show] [-d]
                      shell files_or_code [files_or_code ...]

Sources a file written in a foreign shell language.

positional arguments:
  shell                 Name or path to the foreign shell
  files_or_code         file paths to source or code in the target language.

optional arguments:
  -h, --help            show this help message and exit
  -i INTERACTIVE, --interactive INTERACTIVE
                        whether the sourced shell should be interactive
  -l LOGIN, --login LOGIN
                        whether the sourced shell should be login
  --envcmd ENVCMD       command to print environment
  --aliascmd ALIASCMD   command to print aliases
  --extra-args EXTRA_ARGS
                        extra arguments needed to run the shell
  -s SAFE, --safe SAFE  whether the source shell should be run safely, and not
                        raise any errors, even if they occur.
  -p PREVCMD, --prevcmd PREVCMD
                        command(s) to run before any other commands, replaces
                        traditional source.
  --postcmd POSTCMD     command(s) to run after all other commands
  --funcscmd FUNCSCMD   code to find locations of all native functions in the
                        shell language.
  --sourcer SOURCER     the source command in the target shell language,
                        default: source.
  --use-tmpfile USE_TMPFILE
                        whether the commands for source shell should be
                        written to a temporary file.
  --seterrprevcmd SETERRPREVCMD
                        command(s) to set exit-on-error before anyother
                        commands.
  --seterrpostcmd SETERRPOSTCMD
                        command(s) to set exit-on-error after allother
                        commands.
  --overwrite-aliases   flag for whether or not sourced aliases should replace
                        the current xonsh aliases.
  --suppress-skip-message
                        flag for whether or not skip messages should be
                        suppressed.
  --show                Will show the script output.
  -d, --dry-run         Will not actually source the file.

history

xonshの歴史を扱うためのツール。 historyコマンドとそのすべてのサブコマンドの詳細については、履歴チュートリアル参照してください

usage: history [-h] {show,id,file,info,gc} ...

try 'history <command> --help' for more info

optional arguments:
  -h, --help            show this help message and exit

commands:
  {show,id,file,info,gc}
    show                display history of a session, default command
    id                  display the current session id
    file                display the current history filename
    info                display information about the current history
    gc                  launches a new history garbage collector

replay

xonshの履歴ファイルを再生します。このコマンドの詳細については、履歴チュートリアルの再生セクションを参照してください

usage: replay [-h] [--merge-envs MERGE_ENVS [MERGE_ENVS ...]] [--json]
              [-o TARGET]
              path

replays a xonsh history file

positional arguments:
  path                  path to replay history file

optional arguments:
  -h, --help            show this help message and exit
  --merge-envs MERGE_ENVS [MERGE_ENVS ...]
                        Describes how to merge the environments, in order of
                        increasing precedence. Available strings are 'replay'
                        and 'native'. The 'replay' env comes from the history
                        file that we are replaying. The 'native' env comes
                        from what this instance of xonsh was started up with.
                        One or more of these options may be passed in.
                        Defaults to '--merge-envs replay native'.
  --json                print history info in JSON format
  -o TARGET, --target TARGET
                        path to new history file

timeit

引数についてのタイミングスタディを実行します。IPythonの%timeit魔法と似ています。

scp-resume

シンプルエイリアスは、['rsync', '--partial', '-h', '--progress', '--rsh=ssh']

showcmd

コマンドと引数の評価方法を表示します。

ipynb

シンプルエイリアスは、['ipython', 'notebook', '--no-browser']

trace

実行前にソースコードの行を印刷するためのインターフェイスを提供します。

usage: trace [-h] {on,start,add,off,stop,del,rm,color} ...

tool for tracing xonsh code as it runs.

optional arguments:
  -h, --help            show this help message and exit

action:
  {on,start,add,off,stop,del,rm,color}
    on (start, add)     begins tracing selected files.
    off (stop, del, rm)
                        removes selected files fom tracing.
    color               output color management for tracer.

xpip

pipxonsh自体のパッケージマネージャを実行します。xonshが隔離された環境にある場合(例えばconda、homebrew)に便利です。

一般的には、xpipもしxonshに機能を設定したり追加したりしているのpipならばPython開発をしているなら使用してください。

xonfig

xonsh構成情報を管理します。

usage: xonfig [-h] {info,wizard,styles,colors,tutorial} ...

Manages xonsh configuration.

optional arguments:
  -h, --help            show this help message and exit

action:
  {info,wizard,styles,colors,tutorial}
    info                displays configuration information, default action
    wizard              displays configuration information
    styles              prints available xonsh color styles
    colors              preview color style
    tutorial            Launch tutorial in browser.

Windowsのcmdエイリアス

Windows上の次のエイリアスは次のように拡張されています。['cmd', '/c', alias]

{'cls': ['cmd', '/c', 'cls'],
 'copy': ['cmd', '/c', 'copy'],
 'del': ['cmd', '/c', 'del'],
 'dir': ['cmd', '/c', 'dir'],
 'erase': ['cmd', '/c', 'erase'],
 'md': ['cmd', '/c', 'md'],
 'mkdir': ['cmd', '/c', 'mkdir'],
 'mklink': ['cmd', '/c', 'mklink'],
 'move': ['cmd', '/c', 'move'],
 'rd': ['cmd', '/c', 'rd'],
 'ren': ['cmd', '/c', 'ren'],
 'rename': ['cmd', '/c', 'rename'],
 'rmdir': ['cmd', '/c', 'rmdir'],
 'time': ['cmd', '/c', 'time'],
 'type': ['cmd', '/c', 'type'],
 'vol': ['cmd', '/c', 'vol'],
 }

activate/ deactivateWindowsでAnacondaを使用する

Anaconda Pythonディストリビューションを持つWindows上で、activatedeactivateにエイリアスされています。これにより、同じコマンドを使用してcmd.exeのようにconda環境を有効/無効にすることができます。['source-bat activate']['source-bat deactivate']

sudoWindowsの場合

名前の実行ファイルがあればWindowsでは、sudo見つからない、Xonshが追加sudoポリの助けを借りて「実行管理者として」行動を埋めることを別名ShellExecuteExとし ctypes実際のsudoパラメータはサポートされておらず、実行するコマンドが必要です。

ls

lsコマンドがにエイリアスされ、通常は。Mac OSXでは、代わりにエイリアスになります。['ls', '--color=auto', '-v']['ls', '-G']

grep

grepコマンドはエイリアスです['grep', '--color=auto']

xontrib

xonsh拡張を管理します。