Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Panel

Table of Contents
maxLevel3

Introduction

On this page, we will cover the following:

  1. Adding a new dependent field to exclude_file_ext and file dynamic choice fields
  2. Updating the local template.json to grab the new field
  3. Using the newly added field

Step 1 - Adding a new dependent field to exclude_file_ext and file dynamic choice fields

The exclude_file_ext dynamic choice command runs in the same directory as the workspace, which is why the output shows uip, vscode, cfg, and py. To grab the file extensions in some other directory, we need a new field.

...


Repeat the same for the
file field.

Step 2 - Updating the local template.json to grab the new field

Now, go back to VSCode and run UIP: Pull. You should see the following changes:

...

Code Block
languageyml
titleconfigurations.yml
linenumberstrue
collapsetrue
properties:
  agent:
    log_level: Info
api:
  dynamic_choice_commands:
    exclude_file_ext:
      - name: efe1
        log_level: Inherited
		fields:
			target_directory: 
      - name: efe2
        log_level: Trace
		fields:
			target_directory: 

Step 3 - Using the newly added field

Make the following changes to list_of_file_extensions method in extension.py to use the new target_directory field:

...



Since a breakpoint wasn't set in list_files, the debugger will attach and finish almost immediately. Upon completion, press Shift+Alt+3, and you should see a listing of all the files in your target_directory.
Do the same with exclude_json_files (or whatever you named it), and it should show all the files except the ones that end in .json.

< Previous     Next >