You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* [BREAKING] The confusing flag naming for preserving data volumes created on instance launch --preserve-data-volumes is removed in the compute service
Copy file name to clipboardExpand all lines: scripts/examples/project_o/README.md
+28-14Lines changed: 28 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -55,13 +55,14 @@ Public Subnet VLKn:US-ASHBURN-AD-1 AVAILABLE 10.0.0.0/24 sales
55
55
-*instantly* get usage help as you search for the command
56
56
-*concise* usage typically fits on one screen - no scrolling or searching for the parameter you want
57
57
- expand parameter shortcuts into full parameter names
58
+
- use the first letter of each word for any multi-word parameter, e.g. ``-wfs`` expands to <nobr>``--wait-for-state``</nobr>
58
59
- accept *resource name* in place of OCID values
59
60
- resolve ambiguous *resource name*s
60
61
- resources can be identified by *compartment/name*
61
62
- finds match for partial entry of *name*, *display-name*, *compartment*/*name*
62
-
- identical names can be resolved by using partial OCID.
63
-
- for example, ``-c ujfa`` would specify the *sales* compartment. Four or five characters will uniquely identify most resources.
64
-
- handy when your resource names contain spaces or special characters
63
+
- identical names can be resolved by using a substring from the OCID
64
+
- for example, ``-c ujfa`` would specify the *sales* compartment. The last four to six characters will uniquely identify most resources.
65
+
- handy when your resource names contain spaces or special characters
65
66
- support [complex type] parameters where a list of OCIDs is expected
66
67
- comma-separated resource names are converted to a JSON list
67
68
- simplify [datetime] parameters
@@ -72,7 +73,7 @@ Public Subnet VLKn:US-ASHBURN-AD-1 AVAILABLE 10.0.0.0/24 sales
72
73
-*table:*`-o display#lifecycle` or `-o 'display|lifecycle'`
73
74
-*text:*`-o display/lifecycle` - displays one field per line
74
75
-*csv:*`-o display,lifecycle`
75
-
-*JSON:*`-o json` Show all attributes in unfiltered JSON
76
+
-*JSON:*`-o json` Show unfiltered JSON output from ``oci``
76
77
- Advanced: custom (pythonic) string formatting to truncate long values<br>
77
78
`-o 'display{:.20}|create{:10.10}|id{:>8.8}'` will show a table of:
78
79
- the first 20 characters of *display-name* The column with be sized to fit the longest name, up to a maximum of 20 characters.
@@ -89,24 +90,25 @@ Public Subnet VLKn:US-ASHBURN-AD-1 AVAILABLE 10.0.0.0/24 sales
89
90
-`o ocid sales/bastion`*instantly* shows the full OCIDs for all compartments
90
91
91
92
## How **``o``** works
92
-
-**``o``** compares your input with more than two thousand``oci`` commands, and uses an intelligent algorithm to find the best match.
93
+
-**``o``** compares your input with thousands of``oci`` commands, and uses an intelligent algorithm to find the best match.
93
94
94
-
-**``o``**then provides a usage synopsis, showing required and optional parameters. Add "help" to the end to see global parameters as well. End with ``--help go`` to get full ``oci <command> --help``.
95
+
-**``o <command>``** provides a usage synopsis, showing required and optional parameters for matching commands. Add "help" to the end to see global parameters as well. E.g. <nobr>``o <command> help``</nobr> provides the usage synopsis with global parameters, while <nobr>``o <command> --help go``</nobr> runs <nobr>``oci <command> --help``</nobr>.
95
96
96
97
- You add option and parameter shortcuts, and **``o``** shows you the complete ``oci`` command line after performing command, option, and parameter expansions and substitutions.
97
98
98
-
-**`o`**options such as `o -o field#list` must appear *before* the `<service resource command>` specification. `oci` options must appear *after*`command`. While this option ordering is not strictly required by `oci`, `o`needs this ordering to tell which options are for `o` and which are for `oci`.
99
+
-Options for **`o`** such as `-o field#list` must appear *before* the `<command>` specification. `oci` options must appear *after*`<command>`. While this ordering is not strictly required by `oci`, `o`uses this to determine which options are for `o` and which are for `oci`.
99
100
100
-
- Add "go" to the end of the command and **``o``** will execute the ``oci`` command. ``oci`` typically returns JSON data when you create, get, list, or update resources.
101
+
- Add `go` or `.`to the end of the command and **``o``** will execute the ``oci`` command.
101
102
102
-
-**``o``** inspects the JSON results and collects selected of details about your OCI resources whenever you run any command with ``o ... go``. Most importantly, **``o``** captures resource names and Oracle Cloud IDs (OCIDs). Details are saved to your *$HOME/.oci/ocids* file. **``o``** uses this information to find resources by name, and to translate names to IDs.
103
+
-``oci`` returns JSON data when you create, get, list, or update resources. **``o``** captures resource names and Oracle Cloud IDs (OCIDs) and saves these to your *$HOME/.oci/ocids* file. **``o``** later uses this information to find resources by name, and to translate names to IDs.
103
104
104
-
-Once **``o``**receives JSON results from oci, it scans the returned data dict for key names that match or partially match any of your <nobr>``-o key/word/list``</nobr>. The key words determine *what* presented, while the **``/``** separator character determines *how* they are presented.
105
+
-**``o``**scans the JSON results from ``oci`` for key names that match or partially match any of your <nobr>``-o key/word/list``</nobr>. The key words determine *what* presented, while the **``/``** separator character determines *how* they are presented.
105
106
106
107
## Requirements
107
108
108
109
You will need:
109
110
111
+
- MacOS, Linux or WSL.
110
112
- Python 3.6+. If ``oci`` is installed, you have Python.
111
113
-``oci`` - The Oracle Cloud Infrastructure command line interface must be *installed and configured*.
112
114
- Try running ``oci os ns get`` to verify that it's working.
@@ -127,11 +129,23 @@ When you first run `o` it will tell you how to create the commands file *$HOME/.
127
129
128
130
**OCIDs File**
129
131
130
-
**``o``** uses a local cache of OCID-name mappings called the OCIDs file, located at `.oci/ocids`. If you need to update the OCIDs file after first usage, simply run `o <tenancy_ocid>`.
132
+
**``o``** uses a local cache of OCID-to-name mappings called the OCIDs file, located at *$HOME/.oci/ocids*. This is populated during setup when you run `o <tenancy_ocid>`.
131
133
132
-
**Advanced Setup and Usage**
134
+
To use **``o``** with additional tenancies, simply set your OCI_CLI_PROFILE and run `o <tenancy_ocid>` with the new tenancy OCID.
135
+
136
+
As resources are deleted from your tenancy, **``o``** does automatically remove these from the OCIDs file. Also, as other tenancy users make changes in the tenancy, these changes won't be reflected in your OCIDs file. When these stale OCIDs cause problems with ``o``'s name matching, they may be removed from the OCIDs file with ``o prune <resource-name>``. Or you can start with a fresh OCIDs file by removing *$HOME/.oci/ocids* and run `o <tenancy_ocid>`.
137
+
138
+
**oci_commands File**
139
+
140
+
When you run `o oci_commands`, `o` takes a minute or two to build a list of the thousands of possible `oci` commands with their options, and saves this to *$HOME/.oci/oci_commands*. This list is generated on your system to ensure that it matches the commands in your installed version of `oci`.
133
141
134
-
When you run `o oci_commands`, it takes about a minute to create a list of thousands of possible `oci` commands and their options, and save this to *$HOME/.oci/ocids*. In some cases your `oci` command line environment may be installed without preformatted documentation. In this case it may take 30 to 60 minutes to gather the command information.
142
+
In some cases (in Oracle provided OS images) the `oci` command line environment come be pre-installed, but with incomplete documentation. If so, `o` may take an hour or more to gather the command information. To avoid this you can: copy an *oci_commands* file from another source (preferably with a similar `oci` version) to *$HOME/.oci/oci_commands*; or reinstall oci-cli to ensure the full documentation is included.
143
+
144
+
`oci_commands` should be rebuilt after updating or reinstalling oci-cli. To do this:
145
+
- remove the old file: `rm $HOME/.oci/oci_commands`
146
+
- Rebuild with: `oci oci_commands`
147
+
148
+
**Advanced Setup and Usage**
135
149
136
150
If you use ``oci`` with *instance_principal* authentication, set `` OCI_CLI_AUTH=instance_principal`` in your environment
137
151
(rather than use <nobr>``--auth instance_principal``</nobr> with each command).
@@ -153,7 +167,7 @@ If you use ``oci`` for multiple tenancies, by default ``o`` will save OCIDs for
153
167
Keep it simple.
154
168
155
169
-**``o``** does not have a configuration file
156
-
-**``o``** does not use environment variables
170
+
-**``o``** does not use environment variables (``oci`` does)
157
171
-**``o``** minimizes typing (thus its one-letter name)
0 commit comments