mirror of
https://github.com/platformio/platformio-core.git
synced 2025-07-29 17:47:14 +02:00
Add a new RPC method "project.config_call" for Home API
This commit is contained in:
@ -32,6 +32,10 @@ from platformio.project.helpers import is_platformio_project
|
||||
|
||||
|
||||
class ProjectRPC(object):
|
||||
@staticmethod
|
||||
def config_call(path, method, *args):
|
||||
return getattr(ProjectConfig(path), method)(*args)
|
||||
|
||||
@staticmethod
|
||||
def _get_projects(project_dirs=None):
|
||||
def _get_project_data():
|
||||
|
@ -409,11 +409,11 @@ class ProjectConfig(ProjectConfigBase, ProjectConfigDirsMixin):
|
||||
def __repr__(self):
|
||||
return "<ProjectConfig %s>" % (self.path or "in-memory")
|
||||
|
||||
def as_dict(self):
|
||||
return {s: self.items(s, as_dict=True) for s in self.sections()}
|
||||
|
||||
def to_json(self):
|
||||
result = {}
|
||||
for section in self.sections():
|
||||
result[section] = self.items(section, as_dict=True)
|
||||
return json.dumps(result)
|
||||
return json.dumps(self.as_dict())
|
||||
|
||||
def save(self, path=None):
|
||||
path = path or self.path
|
||||
|
Reference in New Issue
Block a user