Skip to content

Commit

Permalink
add profile and region name to csv file name
Browse files Browse the repository at this point in the history
  • Loading branch information
chinmaysomani07 committed Feb 10, 2023
1 parent db887e8 commit 22e928c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion internal/view/table.go
Expand Up @@ -104,6 +104,8 @@ func (t *Table) toggleWideCmd(evt *tcell.EventKey) *tcell.EventKey {
return nil
}
func (t *Table) importAsCSV(evt *tcell.EventKey) *tcell.EventKey {
_, profile := t.app.profile().GetCurrentOption()
_, region := t.app.region().GetCurrentOption()
var tableData [][]string
rowCount := t.GetRowCount()
colCount := t.GetColumnCount()
Expand All @@ -129,7 +131,7 @@ func (t *Table) importAsCSV(evt *tcell.EventKey) *tcell.EventKey {
if err != nil {
log.Info().Msg(fmt.Sprintf("error in creating csv directory: %v", err))
}
path = filepath.Join(path + "/" + csvFileName[len(csvFileName)-2] + ".csv")
path = filepath.Join(path + "/" + csvFileName[len(csvFileName)-2] + "-" + profile + "-" + region + ".csv")
file, err := os.Create(path)
if err != nil {
log.Info().Msg(fmt.Sprintf("error in creating csv file: %v", err))
Expand Down

0 comments on commit 22e928c

Please sign in to comment.