Refactor subprocess stdlib import
This commit is contained in:
parent
cb742395cc
commit
787a24c6dc
1 changed files with 4 additions and 4 deletions
|
@ -8,7 +8,7 @@
|
||||||
import re
|
import re
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
from subprocess import Popen, PIPE, check_output
|
import subprocess
|
||||||
import options as opts
|
import options as opts
|
||||||
import json
|
import json
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
@ -91,7 +91,7 @@ def log_completed_to_taskwarrior(task_string, date, options):
|
||||||
if options.dryrun:
|
if options.dryrun:
|
||||||
print(cmd)
|
print(cmd)
|
||||||
return
|
return
|
||||||
Popen(cmd)
|
subprocess.Popen(cmd)
|
||||||
|
|
||||||
|
|
||||||
def handle_open_tasks(line, date, options):
|
def handle_open_tasks(line, date, options):
|
||||||
|
@ -119,7 +119,7 @@ def add_incomplete_to_taskwarrior(task_string, date, options):
|
||||||
if options.dryrun:
|
if options.dryrun:
|
||||||
print(cmd)
|
print(cmd)
|
||||||
return
|
return
|
||||||
Popen(cmd)
|
subprocess.Popen(cmd)
|
||||||
|
|
||||||
|
|
||||||
def get_prio_string(task_string):
|
def get_prio_string(task_string):
|
||||||
|
@ -162,7 +162,7 @@ def is_today(cur_date):
|
||||||
def add_today(fname, options):
|
def add_today(fname, options):
|
||||||
cmd = ["task", "+TODAY or +OVERDUE", "export"]
|
cmd = ["task", "+TODAY or +OVERDUE", "export"]
|
||||||
tasks = f"[{TODAY} 09:00] {options.todo_block_title}\n"
|
tasks = f"[{TODAY} 09:00] {options.todo_block_title}\n"
|
||||||
for task in json.loads(check_output(cmd)):
|
for task in json.loads(subprocess.check_output(cmd)):
|
||||||
tasks += f"{task['description']}\n"
|
tasks += f"{task['description']}\n"
|
||||||
|
|
||||||
if options.dryrun:
|
if options.dryrun:
|
||||||
|
|
Loading…
Reference in a new issue