Skip to content

Commit 83e1e53

Browse files
committed
Prepare for v0.8.0
See changelog for more details.
1 parent a051da9 commit 83e1e53

11 files changed

+116
-145
lines changed

.python-version

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.8

CHANGELOG.md

+12
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
# Changelog
22

3+
## v0.8.0 - 2022-09-30
4+
5+
The release started as a minor one to add support for includes (#4). But ended up as quite a big one, because recent releases of Taskfile added features, which allowed removal of `pyyaml` dependency and bumping internal python version to `3.8`.
6+
7+
Here goes a proper list of changes:
8+
9+
- add support for includes by utilizing `--list-all` flag (#4)
10+
- remove `pyyaml` dependency
11+
- bump internal python version to `3.8`
12+
- bump dev dependencies
13+
- update README regarding python version, features and installation
14+
315
## v0.7.0 - 2021-07-16
416

517
Refactor and improve multiple folders handling.

LICENSE.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2021 Ivan Elfimov <[email protected]>
3+
Copyright (c) 2022 Ivan Elfimov <[email protected]>
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

+7-5
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,23 @@
22

33
![Package Control](https://img.shields.io/packagecontrol/dt/Taskfile)
44

5-
A Sublime Text 4 plugin for running tasks from [Taskfile](https://taskfile.dev). It adds `Taskfile: Run Task` to your command palette and you can select which task to run. The output of the task is than displayed in the quick panel on the bottom.
5+
A Sublime Text 4 plugin for running tasks from [Taskfile](https://taskfile.dev). It adds `Taskfile: Run Task` to your command palette and you can select which task to run. The output of the task is then displayed in the quick panel on the bottom.
66

7-
It is also possible to initialize the `Taskfile` with `Taskfile: Init` command, which basically does `task -i` in one of the project directories you chose.
7+
It is also possible to initialize the `Taskfile` with `Taskfile: Init` command, which basically does `task -i` in one of the project directories you choose.
88

99
![Usage](Usage.gif)
1010

1111
- made for Sublime Text 4
12-
- uses [Sublime's python version 3.3](https://www.sublimetext.com/docs/api_environments.html#selecting_python_version), but waiting to migrate to 3.8 once dependencies issue is resolved, see [v0.5.0](https://github.com/biozz/sublime-taskfile/releases/tag/v0.5.0) release notes for more details
13-
- uses [`pyyaml`](https://github.com/packagecontrol/pyyaml) dependency
12+
- has no external dependencies (other than `task` command)
1413
- properly handles multiple open directories
14+
- supports taskfile includes
1515
- does not and will not ship any custom syntax definitions (see installation notes for more details)
1616

1717
## Installation
1818

19-
Use `Package Control: Install Package` command and search for `Taskfile`.
19+
First, [install Taskfile command](https://taskfile.dev/installation/).
20+
21+
Then use `Package Control: Install Package` command and search for `Taskfile`.
2022

2123
If you want to have a hints on which keys are available and what they do, there is an [official JSON schema for Taskfile](https://json.schemastore.org/taskfile.json), which can be loaded automatically once you install [LSP](packagecontrol.io/packages/LSP) and [LSP-yaml](https://packagecontrol.io/packages/LSP-yaml) packages.
2224

Taskfile.py

+22-10
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import os
2+
import subprocess
23
import time
34
from functools import partial
45

56
import sublime
67
import sublime_plugin
7-
import yaml
88

99
TASKFILE_NAME = "Taskfile.yml"
1010

@@ -61,9 +61,7 @@ def select_task(self, folders, index):
6161
if index < 0:
6262
return
6363
folder = folders[index]
64-
taskfile_path = os.path.join(folder, TASKFILE_NAME)
65-
res = yaml.load(open(taskfile_path), Loader=yaml.FullLoader)
66-
items = self.get_tasks_quick_panel_items(res)
64+
items = self.get_tasks_quick_panel_items(folder)
6765
on_done = partial(self.run_task, items, str(folder))
6866
self.window.show_quick_panel(items, on_done)
6967

@@ -79,13 +77,27 @@ def run_task(self, quick_panel_items, working_dir, index):
7977
},
8078
)
8179

82-
def get_tasks_quick_panel_items(self, taskfile):
80+
def get_tasks_quick_panel_items(self, folder):
8381
result = []
84-
for task_name, task in taskfile.get("tasks").items():
85-
summary = task.get("summary")
86-
if summary:
87-
summary = summary.split("\n")[0]
88-
item = sublime.QuickPanelItem(task_name, summary)
82+
# -s flag (silent output) will not work here, because I need task descriptions
83+
# the downside is that I have to parse human-readable output of the command
84+
list_all_result = subprocess.run(
85+
["task", "--list-all"], capture_output=True, cwd=folder
86+
)
87+
if list_all_result.returncode != 0:
88+
print(list_all_result.stderr.decode())
89+
self.window.status_message(
90+
"Unable list tasks: see Sublime's console for more info"
91+
)
92+
return []
93+
# Stdout is sliced because the first line is a general Taskfile message
94+
tasks = list_all_result.stdout.decode().split("* ")[1:]
95+
for task in tasks:
96+
name_raw, summary_raw = task.split("\t")
97+
# The name of each task ends with colon and a space, they need to be removed
98+
name = name_raw[:-2]
99+
summary = summary_raw.strip().replace("\n\n", "\n").split("\n")
100+
item = sublime.QuickPanelItem(name, summary)
89101
result.append(item)
90102
return result
91103

Taskfile.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ version: '3'
22

33
tasks:
44
lint:
5-
summary: |
6-
Lint source code with black and isort.
5+
desc: |
6+
Lint source code with various utilities.
77
cmds:
88
- black .
99
- isort .
1010
- autoflake .
1111
clean:
12-
summary: Remove temporary and cache files.
12+
desc: Remove temporary and cache files.
1313
cmds:
1414
- find . -name '*.pyc' | xargs rm -rf
1515
- find . -name '*__pycache__' | xargs rm -rf

dependencies.json

-7
This file was deleted.

messages.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,6 @@
88
"0.2.0": "messages/0.2.0.md",
99
"0.3.0": "messages/0.3.0.md",
1010
"0.4.0": "messages/0.4.0.md",
11-
"0.5.0": "messages/0.5.0.md"
11+
"0.5.0": "messages/0.5.0.md",
12+
"0.8.0": "messages/0.8.0.md"
1213
}

messages/0.8.0.md

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
## v0.8.0 - 2022-09-30
2+
3+
The release started as a minor one to add support for includes (#4). But ended up as quite a big one, because recent releases of Taskfile added features, which allowed removal of `pyyaml` dependency and bumping internal python version to `3.8`.
4+
5+
Here goes a proper list of changes:
6+
7+
- add support for includes by utilizing `--list-all` flag (#4)
8+
- remove `pyyaml` dependency
9+
- bump internal python version to `3.8`
10+
- bump dev dependencies
11+
- update README regarding python version, features and installation

0 commit comments

Comments
 (0)