Skip to content

Commit

Permalink
minor cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
treethought committed Sep 11, 2021
1 parent 461b185 commit 76142b7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 49 deletions.
45 changes: 0 additions & 45 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,51 +30,6 @@ func Execute() {
}

func init() {
// cobra.OnInitialize(initConfig)

// Here you will define your flags and configuration settings.
// Cobra supports persistent flags, which, if defined here,
// will be global for your application.

rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.masto.yaml)")

}

// initConfig reads in config file and ENV variables if set.
// func initConfig() {
// if cfgFile != "" {
// // Use config file from the flag.
// viper.SetConfigFile(cfgFile)
// } else {
// // Find home directory.
// _, err := homedir.Dir()
// if err != nil {
// fmt.Println(err)
// os.Exit(1)
// }

// // Search config in home directory with name ".masto" (without extension).
// // viper.AddConfigPath(home)
// viper.SetConfigName(".mammut")
// viper.SetConfigName("mammut") // name of config file (without extension)
// viper.SetConfigType("yaml") // REQUIRED if the config file does not have the extension in the name
// viper.AddConfigPath("$HOME/.config") // call multiple times to add many search paths
// viper.AddConfigPath("$HOME") // call multiple times to add many search paths
// viper.AddConfigPath(".") // optionally look for config in the working directory
// if err := viper.ReadInConfig(); err != nil {
// if _, ok := err.(viper.ConfigFileNotFoundError); ok {
// viper.SafeWriteConfig()
// } else {
// panic(fmt.Errorf("Fatal error config file: %s \n", err))
// }
// }

// }

// viper.AutomaticEnv() // read in environment variables that match

// // If a config file is found, read it in.
// if err := viper.ReadInConfig(); err == nil {
// fmt.Println("Using config file:", viper.ConfigFileUsed())
// }
// }
10 changes: 7 additions & 3 deletions ipfs/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ func NewClient(url string) *Client {
return c
}

// func (c *Client) Get(path string, entry *api.MfsLsEntry) ([]byte, error) {
// }

func (c *Client) ReadFile(path string, entry *api.MfsLsEntry) ([]byte, error) {

if entry.Type == api.TDirectory {
Expand Down Expand Up @@ -57,9 +60,6 @@ func (c *Client) ListFiles(path string) (entries []*api.MfsLsEntry, err error) {
fmt.Println(err)
return entries, err
}
for _, e := range entries {
fmt.Println(e.Name, e.Hash, e.Size, e.Type)
}
return entries, nil
}

Expand Down Expand Up @@ -93,3 +93,7 @@ func (c *Client) StatFile(path string, entry *api.MfsLsEntry) (string, error) {
func (c *Client) GetPeers() (*api.SwarmConnInfos, error) {
return c.sh.SwarmPeers(context.TODO())
}

func (c *Client) GetPeer(p string) (*api.PeerInfo, error) {
return c.sh.FindPeer(p)
}
1 change: 0 additions & 1 deletion ui/files.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ type TreeEntry struct {
func (r *RepoTree) buildNodes(basePath string, entries ...*api.MfsLsEntry) []*cview.TreeNode {
nodes := []*cview.TreeNode{}
for _, i := range entries {
fmt.Println(i.Name)
node := cview.NewTreeNode(i.Name)
ref := TreeEntry{
entry: i,
Expand Down

0 comments on commit 76142b7

Please sign in to comment.