def to_stdout(self):
for item in self.items:
- print(item.to_str(delimeter="\t"))
+ print(item.to_str(delimiter="\t"))
@classmethod
def from_csv(cls, file: Path, delimiter="|"):
for item in self:
writer.writerow(item.to_dict())
- def to_stdout(self):
+ def to_stdout(self, show_header=False, delimiter="|"):
if not self:
raise NomError("There are no entries to write.")
+ if show_header:
+ headers = next(iter(self)).get_fieldnames()
+ print(delimiter.join(headers))
for item in self:
print(item.to_str())
\ No newline at end of file
elist.to_csv(ENTRY_LIST)
elif args.command == "entry" and args.entry_command == "show":
elist = EntryList.from_csv(ENTRY_LIST)
- elist.to_stdout()
+ elist.to_stdout(show_header=True)
elif args.command == "feed" and args.feed_command == "update":
feedlist.update_labels()
feedlist.fetch_feeds(FEED_CACHE)
elif args.command == "feed" and args.feed_command == "show":
- feedlist.to_stdout()
+ feedlist.to_stdout(show_header=True)
else:
raise NomError("That option is not yet supported.")