Esempio n. 1
0
func showProject(project *data.Project) (err error) {
	fmt.Printf("       id : %s\n", project.GetShaFromName())
	fmt.Printf("     name : %s\n", project.GetName())
	fmt.Printf("  entries : %d\n", len(project.Entries()))
	fmt.Printf(" location : %s\n", project.Location())
	return nil
}
Esempio n. 2
0
func TestListProjects(t *testing.T) {
	var project *data.Project
	for _, project = range data.DB.Projects() {
		if ok, _ := project.OnClock(); ok {
			fmt.Printf("Project: %s (ticking...)\n",
				project.GetName(),
			)
		}
	}
}
Esempio n. 3
0
func moveProject(project, newProject *data.Project) error {
	for _, entry := range project.Entries() {
		entry.Project = newProject
		if err := data.Save(entry); err != nil {
			return err
		}
	}

	fmt.Printf("All entries copied to project \"%s\" \n...\n", newProject.GetName())
	return deleteProject(project)
}
Esempio n. 4
0
func deleteProject(project *data.Project) (err error) {
	var remove string
	fmt.Printf(
		"Remove all data for project \"%s\" ([No]/yes)? ",
		project.GetName(),
	)

	if fmt.Scanln(&remove); remove == "yes" {
		err = data.Destroy(project)
	}
	return
}