Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
dennykorsukewitz committed Nov 22, 2023
1 parent 389b3ec commit 5b6f9e4
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 49 deletions.
1 change: 1 addition & 0 deletions .github/workflows/unittest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ jobs:
git config --global user.name "Denny Korsukéwitz"
git config --global github.user "dennykorsukewitz"
git config --global github.name "Denny Korsukéwitz"
git config --global github.username "Denny Korsukéwitz"
- name: git config user.name
run: git config --global --get user.name
- name: git config user.user
Expand Down
33 changes: 22 additions & 11 deletions generators/plugin/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,34 @@ const config = {
prompts: [
{
name: 'plugin_name',
message: 'What is the name of your new plugin?',
message: 'What is the name of your new plugin (python file name)?',
type: 'input',
default: '${config.package_name_pascal_case}',
store: true,
},
{
name: 'framework_version',
message: 'For which framework version should this package be?',
type: 'list',
name: 'command_name',
message: 'What is the name of your new command?',
type: 'input',
default: '${config.package_name_pascal_case}',
},
{
name: 'command_type',
message: 'Which command type do you need?',
type: 'list',
choices: [
'3.3.x',
'4.0.x',
'5.0.x',
'6.0.x',
'6.5.x'
{
name: 'TextCommand - provide access to the contents of the selected file/buffer via a View object.',
value: 'TextCommand',
},
{
name: 'WindowCommand - provide references to the current window via a Window object.',
value: 'WindowCommand',
},
{
name: 'ApplicationCommand - do not have a reference to any specific window or file/buffer and are more rarely used',
value: 'ApplicationCommand',
},
],
store: true,
},
],
};
Expand Down
2 changes: 2 additions & 0 deletions generators/plugin/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const Generator = require('yeoman-generator');
const chalk = require('chalk');
const yosay = require('yosay');
const path = require('path');
const changeCase = require('change-case');
const helper = require('./../../src/helper.js');
const generator = path.basename(__dirname);
const generator_config = require('./config.js');
Expand Down Expand Up @@ -51,6 +52,7 @@ module.exports = class extends Generator {
...answers,
};

data.command_name = changeCase.pascalCase(data.command_name);
this.renderTemplate(
this.templatePath('plugin.py'),
this.destinationPath(`${data.package_name_pascal_case}.py`),
Expand Down
38 changes: 0 additions & 38 deletions generators/plugin/templates/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,41 +44,3 @@ def input_panel_set(self, value):

if value == -1:
return


class ExampleCommand(sublime_plugin.WindowCommand):
def run(self):

self.view.insert(edit, 0, "Hello, World!")

# Status Message
sublime.status_message("Hello, World!")

# Owner/Repository Selection.
self.window.show_quick_panel(
items=["yes", "no"],
on_select=self.quick_panel_selected,
on_highlight=None,
flags=32,
selected_index=-1,
placeholder="Your placeholder",
)

# Create search_string input panel
self.window.show_input_panel(
caption="Hello, World!",
initial_text="Hello, World!",
on_done=self.input_panel_set,
on_change=None,
on_cancel=None,
)

def quick_panel_selected(self, index):

if index == -1:
return

def input_panel_set(self, value):

if value == -1:
return

0 comments on commit 5b6f9e4

Please sign in to comment.